Fwd: Bug#249036: postgresql: zero bytes cannot be entered in string literal, not even with \000 notation - Mailing list pgsql-bugs

From Martin Pitt
Subject Fwd: Bug#249036: postgresql: zero bytes cannot be entered in string literal, not even with \000 notation
Date
Msg-id 20040517120821.GC30889@web08.manitu.net
Whole thread Raw
Responses Re: Fwd: Bug#249036: postgresql: zero bytes cannot be entered  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-bugs
Hi PostgreSQL hackers!

We recently got the Debian bug report below. Does anybody have an idea about that?

Thanks and have a nice day!

Martin

----- Forwarded message from Peter Schueller <peter.schueller@rise.tuwien.ac.at> -----

Subject: Bug#249036: postgresql: zero bytes cannot be entered in string
    literal, not even with \000 notation
Reply-To: Peter Schueller <peter.schueller@rise.tuwien.ac.at>,
   249036@bugs.debian.org
From: Peter Schueller <peter.schueller@rise.tuwien.ac.at>
To: submit@bugs.debian.org
Date: Fri, 14 May 2004 17:26:33 +0200
X-Spam-Status: No, hits=0.0 required=4.0 tests=none autolearn=no version=2.61

Package: postgresql
Severity: normal


if i issue the following query:
$ select decode(encode('\001\000\001'::bytea,'hex'),'hex');
the result will always be '\001' and not '\001\000\001' as assumable.

i think the string is handled zero-delimited and not with its given
size,
and i think in this case this is not the wanted behaviour because to
enter any bytea with zero bytes one will have to use
decode('my string in hex', 'hex'), only then the zero bytes will be
stored
correctly.

versions:
ii  postgresql     7.4.2-4        Object-relational SQL database, ...
ii  postgresql-cli 7.4.2-4        Front-end programs for PostgreSQL

thx,
Peter Schueller

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.6
Locale: LANG=C, LC_CTYPE=C





----- End forwarded message -----

--
Martin Pitt                 Debian GNU/Linux Developer
martin@piware.de                      mpitt@debian.org
http://www.piware.de             http://www.debian.org

pgsql-bugs by date:

Previous
From: Rachel Willmer
Date:
Subject: Re: V7.4.2: drop database does not drop schemas/table/data
Next
From: Martin Pitt
Date:
Subject: Patch for not going beyond NOFILE system limit