X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CE7CC11F7081 for ; Fri, 14 Apr 2006 12:48:35 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.125 X-Spam-Level: X-Spam-Status: No, score=0.125 required=5 tests=[AWL=0.125] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id aA3ExqDS5WxK for ; Fri, 14 Apr 2006 12:48:31 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D8C9A11F6F8E for ; Fri, 14 Apr 2006 12:48:30 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k3EFmM58009725; Fri, 14 Apr 2006 11:48:22 -0400 (EDT) To: Michael Glaesemann cc: venu gopal , pgsql-general Subject: Re: what the problem with this query In-reply-to: References: <20060414110916.9271.qmail@web25608.mail.ukl.yahoo.com> Comments: In-reply-to Michael Glaesemann message dated "Fri, 14 Apr 2006 20:36:05 +0900" Date: Fri, 14 Apr 2006 11:48:22 -0400 Message-ID: <9724.1145029702@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200604/683 X-Sequence-Number: 94124 Michael Glaesemann writes: > I'm not familiar with the syntax you're using, but one problem is > that your parentheses are not balanced -- there's an extra closing > parenthesis. That's probably what the error is complaining about. You > might want to try to use whitespace to see the structure of your > query better, e.g., Also, consider using a newer Postgres release. 8.0 and up provide a cursor pointer so that you don't have to count characters: regression=# SELECT o.orgunitname AS ouname, e.entrynumber AS value_field, centroid(c.the_geom) AS the_geom, c.ogc_fid AS ogc_fid FROM (ctrphc AS c INNER JOIN orgunit o ON c.dhs_ouname = o.orgunitname) INNER JOIN (SELECT orgunitid, entrynumber FROM routinedataou4 WHERE dataelementid=1195 AND dataperiodid = 86) AS e ON o.orgunitid = e.orgunitid) AS new_table USING UNIQUE ogc_fid USING SRID=-1; ERROR: syntax error at or near ")" at character 333 LINE 1: ...taperiodid = 86) AS e ON o.orgunitid = e.orgunitid) AS new_t... ^ regression=# regards, tom lane