Getting X coordinate from a point(lseg), btw i read the man page about points. - Mailing list pgsql-general

From Ing.Edmundo.Robles.Lopez
Subject Getting X coordinate from a point(lseg), btw i read the man page about points.
Date
Msg-id 4EA963E5.4090308@sensacd.com.mx
Whole thread Raw
Responses Re: Getting X coordinate from a point(lseg), btw i read the man page about points.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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.
1st. i have a field    
Column   |         Type          |           Modifiers
-----------+-----------------------+-------------------------------
 id          | integer               | not null
 info       | lseg                  |
After read  the above,  i tried to 
select  info from table limit 1;
                        info
----------------------------------------------------
 [(647753.125,2825633.75),(647738.8125,2825626.75)]
      
the value  i want to get is: 647753.125
so i tried to do:
 select  info[0] from table limit 1;
          info
-------------------------
 (647753.125,2825633.75)
 i still want to get  647753.125, so i did:
select  info[0][0] from table limit 1;
 info
------
(1 row)
But, nothing appears like a NULL.
then i did:
 select point(info[0])[0]  from table limit 1;
ERROR:  syntax error at or near "["
LINE 1: select point(info[0])[0]  from table limit 1;
and finally i wrote this mail  :-)
Regards.

El contenido de este correo electrónico y sus archivos adjuntos son privados y confidenciales y va dirigido exclusivamente a su destinatario.  No se autoriza la utilización, retransmisión, diseminación, o cualquier otro uso de esta información por un receptor o entidades distintas al destinatario.  Si recibe este correo sin ser el destinatario se le solicita eliminarlo y hacerlo del conocimiento del emisor. La empresa no se hace responsable de transmisiones o comunicaciones no autorizadas o emitidas por personas ajenas a sus colaboradores utilizando éste medio electrónico.

 

The content of this email and its attached files are private and confidential and intended exclusively for the use of the individual or entity to which they are addressed. The retransmission, dissemination, or any other use of this information other than by the intended recipient is prohibited.  If you have received this email in error please delete it and notify the sender.  The company cannot be held liable for unauthorized electronic transmissions or communications, nor for those emitted by non-company individuals and entities.

 

pgsql-general by date:

Previous
From: "Ing.Edmundo.Robles.Lopez"
Date:
Subject: How are PGRES_FATAL_ERROR raised?????
Next
From: rihad
Date:
Subject: Are pg_xlog/* fiels necessary for PITR?