pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
manipulating the POINT data type
2+ messages / 2 participants
[nested] [flat]

* manipulating the POINT data type
@ 2002-08-07 17:16  Floyd Shackelford <floyds@4peakstech.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Floyd Shackelford @ 2002-08-07 17:16 UTC (permalink / raw)
  To: pgsql-sql


how do i manipulate the POINT data type in a select statement? how do i
reference the X and Y portions of the point? for instance, can i select the
X or Y portion of a POINT? can i do something like "select pointa.x" or
"where pointa.x = pointb.x"?

When using JDBC, when i get a POINT value from a result set, what am i
getting? a java.awt.Point or a string?

Regards,

Floyd Shackelford
4 Peaks Technology Group, Inc.
VOICE: 334.735.9428
FAX:   916.404.7125
EMAIL: FloydS@4PeaksTech.com
ICQ #: 161371538
acta non verba




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: manipulating the POINT data type
@ 2002-08-08 13:35  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Floyd Shackelford <floyds@4peakstech.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2002-08-08 13:35 UTC (permalink / raw)
  To: floyds@4peakstech.com; +Cc: pgsql-sql

"Floyd Shackelford" <floyds@4peakstech.com> writes:
> how do i manipulate the POINT data type in a select statement? how do i
> reference the X and Y portions of the point? for instance, can i select the
> X or Y portion of a POINT?

Yeah, pretend it's an array with indexes 0,1.

regression=# create table p (f1 point);
CREATE TABLE
regression=# insert into p values('(12,34)');
INSERT 437746 1
regression=# select f1[0] from p;
 f1
----
 12
(1 row)

regression=# select f1[1] from p;
 f1
----
 34
(1 row)

regression=# update p set f1[1] = 55;
UPDATE 1
regression=# select * from p;
   f1
---------
 (12,55)
(1 row)

regression=#

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-08-08 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-07 17:16 manipulating the POINT data type Floyd Shackelford <floyds@4peakstech.com>
2002-08-08 13:35 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox