X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 34EB7475AAC for ; Thu, 27 Feb 2003 16:52:20 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 61245-09 for ; Thu, 27 Feb 2003 16:52:06 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 6F508475A09 for ; Thu, 27 Feb 2003 16:12:27 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 53CE643A928; Thu, 27 Feb 2003 16:12:27 -0500 (EST) From: dhoubrechts X-Newsgroups: comp.databases.postgresql.sql Subject: use of geometric types in select ? Date: Thu, 27 Feb 2003 22:07:53 +0100 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 24 Message-ID: <3E5E7E29.58D19347@cybernet.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org X-Mailer: Mozilla 4.75 [fr] (X11; U; Linux 2.2.17-21mdk i686) X-Accept-Language: fr-BE, fr-FR, en To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/641 X-Sequence-Number: 12039 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'; Thanks for help Didier.