"Ing.Edmundo.Robles.Lopez" <erobles@xxxxxxxxxxxxxx> writes: > Hi in the main page about geometric operations said: > It is possible to access the two component numbers of a point as though it were an array with indices 0 and 1. For example, if t.p is a point column then SELECT p[0] FROM t retrieves the X coordinate and UPDATE t SET p[1] = ... changes the Y coordinate. In the same way, a value of type box or lseg can be treated as an array of two point values. > [ So how to get p2.x from an lseg value? ] > select info[0] from table limit 1; > (647753.125,2825633.75) Right, that gets you a point. > i still want to get647753.125, so i did: > select info[0][0] from table limit 1; Close, but that notation only works for a 2-dimensional array, which an lseg is not. What you need is regression=# select (info[0])[0] from table; f1 ------------ 647753.125 (1 row) The parenthesized object is a point, and then an entirely separate subscripting operation has to be applied to it to get its X coordinate. > then i did: > select point(info[0])[0] from table limit 1; Well, that's unnecessary since info[0] is already a point, but the syntactic problem is again that you have to parenthesize the thing that the second subscript is being applied to: select (point(info[0]))[0] from table limit 1; You need parentheses any time you're going to apply subscripting or field selection to something that isn't a simple variable reference. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general