Thread: BUG #3226: ODBC driver 8.02.02 parses subqueries incorrectly

BUG #3226: ODBC driver 8.02.02 parses subqueries incorrectly

From
"sean song"
Date:
The following bug has been logged online:

Bug reference:      3226
Logged by:          sean song
Email address:      seanpssong@yahoo.com
PostgreSQL version: 8.2.3
Operating system:   Windows XP sp2 (happen on all versions of Windows OS)
Description:        ODBC driver 8.02.02 parses subqueries incorrectly
Details:

Problem description:

the ODBC driver seems confused by suqueries. e.g.

select test1.*, testsub.t1
from test1
left join
(select t1 from test2) as testsub

I get error from ODBC while debuging my code, saying returned E_FAIL. This
did not happen on version 8.0.

here is the ODBC log:

Global Options: Version='08.02.0200', fetch=100, socket=8192,
unknown_sizes=0, max_varchar_size=8192, max_longvarchar_size=32768
                disable_optimizer=1, ksqo=1, unique_index=1,
use_declarefetch=0
                text_as_longvarchar=0, unknowns_as_longvarchar=0,
bools_as_char=0 NAMEDATALEN=64
                extra_systable_prefixes='dd_', conn_settings=''
conn_encoding='OTHER'

and errors logged just after the query:

conn=06430048, query='select nspname from pg_namespace n, pg_class c where
c.relnamespace=n.oid and c.oid='"select"'::regclass'
ERROR from backend during send_query: 'ERROR:  relation "select" does not
exist'
STATEMENT ERROR: func=parse_statement, desc='', errnum=1, errmsg='Table not
found'


looks like function parse_statement didn't understand subquery, instead it
treats 'select' after 'join' as a table name.


* this query runs perfectly on pgAdmin.

Re: BUG #3226: ODBC driver 8.02.02 parses subqueries incorrectly

From
Hiroshi Inoue
Date:
sean song wrote:
> The following bug has been logged online:
>
> Bug reference:      3226
> Logged by:          sean song
> Email address:      seanpssong@yahoo.com
> PostgreSQL version: 8.2.3
> Operating system:   Windows XP sp2 (happen on all versions of Windows OS)
> Description:        ODBC driver 8.02.02 parses subqueries incorrectly
> Details:
>
> Problem description:
>
> the ODBC driver seems confused by suqueries. e.g.

Could you try the snapshot driver at
  http://www.geocities.jp/inocchichichi/psqlodbc/index.html
?

regards,
Hiroshi Inoue