Search Postgresql Archives

Getting X coordinate from a point(lseg), btw i read the man page about points.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux