X-Original-To: pgsql-interfaces@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C1B55476019 for ; Thu, 27 Feb 2003 20:18:37 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 24834-06 for ; Thu, 27 Feb 2003 20:18:27 -0500 (EST) Received: from ints.mail.pike.ru (ints.mail.pike.ru [195.9.45.194]) by postgresql.org (Postfix) with ESMTP id F12DE4761DC for ; Thu, 27 Feb 2003 18:29:56 -0500 (EST) Received: (qmail 28352 invoked from network); 27 Feb 2003 23:46:48 -0000 Received: from babolo.ru (HELO cicuta.babolo.ru) (194.58.226.160) by ints.mail.pike.ru with SMTP; 27 Feb 2003 23:46:48 -0000 Received: (nullmailer pid 684 invoked by uid 136); Thu, 27 Feb 2003 23:32:03 -0000 Subject: Re: use off geometric types X-ELM-OSV: (Our standard violations) hdr-charset=KOI8-R; no-hdr-encoding=1 In-Reply-To: <3E5E7C52.2138702B@cybernet.be> To: dhoubrechts Date: Fri, 28 Feb 2003 02:32:03 +0300 (MSK) From: "."@babolo.ru Cc: "pgsql-interfaces@postgresql.org" X-Mailer: ELM [version 2.4ME+ PL99b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: <1046388723.861187.683.nullmailer@cicuta.babolo.ru> X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/126 X-Sequence-Number: 3747 > I create a db : createdb geo > I log into the db : psql geo > I create a table named poly : > geo=# create table poly (parc varchar(15), graphic polygon); > > I populate the table : > 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)'); > > Now I would look if the first polygon overlaps the second using the > varchars for retriving the poly. > I could do it so : > geo=# 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=# select graphic::polygon from poly where parc='A52' && select > graphic::polygon from poly where parc='A135'; SELECT a.graphic && b.graphic FROM poly a, poly b WHERE a.parc='A52' AND b.parc='A135'; But if you want to find all overlaps SELECT a.parc, b.parc FROM poly a, poly b WHERE a.graphic && b.graphic;