[SQL] Geometric, getting x and y co-ordinates from point data type/

From: Stuart Rison <stuart(at)ludwig(dot)ucl(dot)ac(dot)uk>
To: pgsql-sql(at)postgresql(dot)org
Cc: stuart(at)ludwig(dot)ucl(dot)ac(dot)uk
Subject: [SQL] Geometric, getting x and y co-ordinates from point data type/
Date: 1999-06-03 13:33:16
Message-ID: v04020a04b37c33bdb616@[128.40.242.190]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi there,

Suppose you have a table:

id pos
1 (0,5)
2 (-1,6)
3 (5.5,9.8)

Are there functions to get to the individual coords such that

SELECT id,x_coord(pos),y_coord(pos) FROM table;

gives

id x_coord y_coord
1 0 5
2 -1 6
3 5.5 9.8

Stuart.

+-------------------------+--------------------------------------+
| Stuart Rison | Ludwig Institute for Cancer Research |
+-------------------------+ 91 Riding House Street |
| Tel. (0171) 878 4041 | London, W1P 8BT, UNITED KINGDOM. |
| Fax. (0171) 878 4040 | stuart(at)ludwig(dot)ucl(dot)ac(dot)uk |
+-------------------------+--------------------------------------+

Browse pgsql-sql by date

  From Date Subject
Next Message Mark Wright 1999-06-03 14:47:40 Re: [SQL] Are PL/pgSQL calls atomic?
Previous Message Jan Wieck 1999-06-03 10:24:16 Re: [SQL] Are PL/pgSQL calls atomic?