pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedEmpty bytea values on 9.2.1
4+ messages / 2 participants
[nested] [flat]
* Empty bytea values on 9.2.1
@ 2012-10-29 17:58 Nils Gösche <cartan@cartan.de>
2012-10-29 19:36 ` Re: Empty bytea values on 9.2.1 Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: Nils Gösche @ 2012-10-29 17:58 UTC (permalink / raw)
To: pgsql-odbc
Hi!
On an 8.4 installation, I have a table with a bytea column. In some rows, the
value of this column has length 0. When I query that table with a normal SELECT,
using the ODBC driver from C#, I get a byte[] object of length 0 on those rows.
So far so good.
Now, I dumped the database and restored it on a 9.2.1 installation. The tables
look the same on the new installation: Zero length of the bytea values in some
columns. However, if I try to retrieve such rows with the exact same program as
above, with the same ODBC driver, same connection string except the host name,
suddenly I get a byte[] object of length 1! And the one byte in that array
appears to be random!
At first, I thought it might be a Postgres bug. I wrote a simple program that
uses Npgsql to retrieve those rows, however, the behavior wasn't reproducible
anymore that way. It occurs only if I use ODBC. So, I suspect there is something
in the ODBC driver causing this.
Can anybody else confirm this?
Regards,
--
Nils Gösche
"Don't ask for whom the <CTRL-G> tolls."
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Empty bytea values on 9.2.1
2012-10-29 17:58 Empty bytea values on 9.2.1 Nils Gösche <cartan@cartan.de>
@ 2012-10-29 19:36 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-10-30 10:09 ` Re: Empty bytea values on 9.2.1 Nils Gösche <cartan@cartan.de>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lane @ 2012-10-29 19:36 UTC (permalink / raw)
To: Nils Gösche <cartan@cartan.de>; +Cc: pgsql-odbc
=?utf-8?Q?Nils_G=C3=B6sche?= <cartan@cartan.de> writes:
> On an 8.4 installation, I have a table with a bytea column. In some rows, the
> value of this column has length 0. When I query that table with a normal SELECT,
> using the ODBC driver from C#, I get a byte[] object of length 0 on those rows.
> So far so good.
> Now, I dumped the database and restored it on a 9.2.1 installation.
9.0 and later default to showing bytea output in "hex" format. I wonder
whether you are using a version of the ODBC code that handles that.
If not, you many need to set "bytea_output" to "escape".
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Empty bytea values on 9.2.1
2012-10-29 17:58 Empty bytea values on 9.2.1 Nils Gösche <cartan@cartan.de>
2012-10-29 19:36 ` Re: Empty bytea values on 9.2.1 Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-10-30 10:09 ` Nils Gösche <cartan@cartan.de>
2012-10-30 14:18 ` Re: Empty bytea values on 9.2.1 Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: Nils Gösche @ 2012-10-30 10:09 UTC (permalink / raw)
To: 'Tom Lane' <tgl@sss.pgh.pa.us>; +Cc: pgsql-odbc
Tom wrote:
> 9.0 and later default to showing bytea output in "hex" format. I
> wonder whether you are using a version of the ODBC code that handles
> that.
I am using version 9.01.02.00 which is rather recent, I think.
> If not, you many need to set "bytea_output" to "escape".
Good idea: That fixes it!
Interestingly, longer bytea values seem to work fine even without
setting bytea_output to 'escape'! It's only the empty arrays that
seem to make problems.
Regards,
--
Nils Gösche
"Don't ask for whom the <CTRL-G> tolls."
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Empty bytea values on 9.2.1
2012-10-29 17:58 Empty bytea values on 9.2.1 Nils Gösche <cartan@cartan.de>
2012-10-29 19:36 ` Re: Empty bytea values on 9.2.1 Tom Lane <tgl@sss.pgh.pa.us>
2012-10-30 10:09 ` Re: Empty bytea values on 9.2.1 Nils Gösche <cartan@cartan.de>
@ 2012-10-30 14:18 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2012-10-30 14:18 UTC (permalink / raw)
To: Nils Gösche <cartan@cartan.de>; +Cc: pgsql-odbc
=?UTF-8?Q?Nils_G=C3=B6sche?= <cartan@cartan.de> writes:
> Interestingly, longer bytea values seem to work fine even without
> setting bytea_output to 'escape'! It's only the empty arrays that
> seem to make problems.
That suggests that ODBC is doing something wrong with just '\x' ...
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2012-10-30 14:18 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-10-29 17:58 Empty bytea values on 9.2.1 Nils Gösche <cartan@cartan.de>
2012-10-29 19:36 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-10-30 10:09 ` Nils Gösche <cartan@cartan.de>
2012-10-30 14:18 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox