Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e6CIGAW85120 for ; Wed, 12 Jul 2000 14:16:11 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id OAA24285; Wed, 12 Jul 2000 14:16:07 -0400 (EDT) To: Cedar Cox cc: pgsql-interfaces@postgresql.org Subject: Re: more ODBC driver In-reply-to: References: Comments: In-reply-to Cedar Cox message dated "Wed, 12 Jul 2000 18:33:50 +0300" Date: Wed, 12 Jul 2000 14:16:07 -0400 Message-ID: <24282.963425767@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200007/82 Cedar Cox writes: > Despite this, other things seem to work. Now here's my problem. When > executing a query in Access, I get the error: > Error while executing the query; > ERROR: parser: parse error at or near "{" (#1) > The SQL received by the back end is (get ready!): > (((SELECT "T1"."TreeID" ,"T1"."Name" ,(textcat(({fn concat(({fn > concat(({fn concat(({fn concat(({fn concat(({fn concat(({fn > concat("T1"."Name" ,' ' )) ,"T2"."Name" )}) ,' ' > )}) ,"T2"."Description" )}) ,' ' )}) ,"T3"."Name" )}) ,' ' > )}) ,"T3"."Description" )}) , > The query text in Access is (equally as ugly): > SELECT T1.TreeID as TreeID, T1.Name AS Name, T1.Name&' '&T2.Name&' > '&T2.Description&' '&T3.Name&' '&T3.Description AS Description, It looks like the & operators are being translated to the ODBC notation {fn concat(a,b)}, which isn't valid SQL. The ODBC driver is supposed to translate that to the Postgres equivalent, namely textcat(a,b). Unfortunately our ODBC driver isn't bright enough to do that for nested function calls, and as you can see in the SQL log only the outermost instance is getting fixed properly. Probably the best short-term workaround is to write the query using the Postgres function to begin with: SELECT ..., textcat(T1.Name,textcat(' ',textcat(T2.Name,textcat(' ', ... I'm not sure if we have a TODO item to fix the ODBC driver's function translation code, but we should... regards, tom lane