Re: CommitFest status summary 2010-01-27 - Mailing list pgsql-hackers

From Boszormenyi Zoltan
Subject Re: CommitFest status summary 2010-01-27
Date
Msg-id 4B73F464.8050506@cybertec.at
Whole thread Raw
In response to Re: CommitFest status summary 2010-01-27  (Boszormenyi Zoltan <zb@cybertec.at>)
List pgsql-hackers
Hi,

Boszormenyi Zoltan írta:
> Greg Smith írta:
>   
>> 4) Investigate and be explicit about the potential breakage here both
>> for libpq clients and at least one additional driver too.  If I saw a
>> demonstration that this didn't break the JDBC driver, for example, I'd
>> feel a lot better about the patch.
>>     
> ... (JDBC discussed to be non-vulnerable)
> The question is whether new versions of psqlODBC and the old
> ones shipped in unixODBC handle the change well.
>   

I looked at the unixODBC PG driver sources. Both the "old" and "new"
versions return rowcount for STMT_TYPE_SELECT as the number of
tuples returned, it doesn't look at the command status. But they both seems
to be broken for INSERTs, as the source interprets the number found
after the first ' ' (space) character, they would return 0 for WITHOUT OIDS
case. I am talking about these files:   unixODBC-x.y.z/Drivers/PostgreSQL/results.c
unixODBC-x.y.z/Drivers/Postgre7.1/results.c
Look at the SQLRowCount() function.

The current psqlODBC driver versions do it in a similar way.
They don't look at the actual command tag, if there is a space character
in the command status string after trimming it, the string after the space
gets interpreted with atoi(). This code also ignores that INSERT returns
2 values, the first value will be returned for rowcount.

This means that the more recent ODBC drivers seem to start returning
rowcount for utility SELECTs with this protocol change.
I haven't tested it though.

So, the latest JDBC won't change behaviour without code changes,
ODBC may or may not, depending on the version.

Best regards,
Zoltán Böszörményi

-- 
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/



pgsql-hackers by date:

Previous
From: Bart Samwel
Date:
Subject: Re: Avoiding bad prepared-statement plans.
Next
From: Heikki Linnakangas
Date:
Subject: Re: Parameter name standby_mode