X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EDD46474E44 for ; Sat, 1 Mar 2003 03:37:21 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 24644-07 for ; Sat, 1 Mar 2003 03:37:21 -0500 (EST) Received: from shield.pirmabanka.lv (unknown [195.114.57.4]) by postgresql.org (Postfix) with ESMTP id 24766474E42 for ; Sat, 1 Mar 2003 03:37:20 -0500 (EST) Received: from wall2.pirmabanka.lv (wall2-pub.pirmabanka.lv [195.114.57.14]) by shield.pirmabanka.lv (8.9.3/8.9.3) with SMTP id KAA26700 for ; Sat, 1 Mar 2003 10:37:20 +0200 Received: from share.pirmabanka.lv ([10.0.0.10]) by wall2.pirmabanka.lv; Sat, 01 Mar 2003 10:37:19 +0200 (EET) Received: from pc311x1.pirmabanka.lv (IDENT:root@localhost.localdomain [127.0.0.1]) by pirmabanka.lv (8.11.5/8.11.5) with SMTP id h218bJM22451 for ; Sat, 1 Mar 2003 10:37:19 +0200 Received: (qmail 10929 invoked by uid 100); 1 Mar 2003 08:37:30 -0000 Date: Sat, 1 Mar 2003 10:37:30 +0200 From: "Victor Yegorov" To: pgsql-sql@postgresql.org Subject: Re: use of geometric types in select ? Message-ID: <20030301083730.GA9377@pirmabanka.lv> Mail-Followup-To: pgsql-sql@postgresql.org References: <3E5E7E29.58D19347@cybernet.be> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: <3E5E7E29.58D19347@cybernet.be> User-Agent: Mutt/1.4i X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/3 X-Sequence-Number: 12043 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * dhoubrechts [01.03.2003 03:32]: > I create a db : createdb geo > I log into the db : psql geo > I create a table named poly : > geo=3D# create table poly (parc varchar(15), graphic polygon); >=20 > I populate the table :=20 > insert into poly values('A52','(2,1),(1,3),(2,5),(4,6),(6,4),(5,2)'); > insert into poly values('A135','(3,3),(7,4),(8,2),(4,1)'); >=20 > Now I would look if the first polygon overlaps the second using the > varchars for retriving the poly. > I could do it so : > geo=3D# select '((2,1),(1,3),(2,5),(4,6),(6,4),(5,2))'::polygon && > '((3,3),(7,4),(8,2),(4,1))'::polygon; > ?column? > ---------- > t > (1 row) > Now, how can I do to have something like : > geo=3D# select graphic::polygon from poly where parc=3D'A52' && select > graphic::polygon from poly where parc=3D'A135'; Something like this: select (g1.graphic && g2.graphic) from poly g1, poly g2 where g1.parc =3D 'A52' and g2.parc =3D 'A135'; --=20 Victor Yegorov --oyUTqETQ0mS9luUI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+YHFK2RKGLEykUDYRAsgrAJwLnNY+TL3CDsSv5HPWVCNgL/FrIwCgv66e LQwf/YKA2UWnkk9VuWNgtqk= =K8tw -----END PGP SIGNATURE----- --oyUTqETQ0mS9luUI--