From: | Michael Fuhr <mfuhr+pgsql-sql(at)fuhr(dot)org> |
---|---|
To: | Daniel Lau <iedaniel(at)ust(dot)hk> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Get x from point? |
Date: | 2003-12-22 10:53:53 |
Message-ID: | 20031222035353.A27167@quality.qadas.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Mon, Dec 22, 2003 at 04:54:01PM +0800, Daniel Lau wrote:
> I am wondering if we are able to extract the x-coordinate from a
> point-type attribute with SQL. I have been looking for this sort of
> functions from documents and websites but it seems the function does not
> exist. Or, any altnernate to do so?
From the bottom of the Geometric Functions and Operators chapter of
the documentation:
"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 may be treated as an array of two point
values."
http://www.postgresql.org/docs/current/static/functions-geometry.html
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
From | Date | Subject | |
---|---|---|---|
Next Message | LAIN Lucas TECHTEL | 2003-12-22 14:58:26 | restoring database |
Previous Message | Richard Huxton | 2003-12-22 10:48:20 | Re: how to preserve \n in select statement |