Re: insert char(1) type by different ways.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "And(dot) Andruikhanov" <andy(at)euinf(dot)dp(dot)ua>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: insert char(1) type by different ways.
Date: 2001-02-03 20:33:52
Message-ID: 2688.981232432@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"And. Andruikhanov" <andy(at)euinf(dot)dp(dot)ua> writes:
> insert into ku values(1, '\000');

This cannot work as you expect, because what comes out of the parser is
a string containing a single null character --- and that's fed to a
datatype input routine that expects a null-terminated string. So the
char(n) input routine thinks you entered just '', which it blank-pads
to one character.

In general the Postgres I/O routines are not friendly to embedded nulls.
The char/varchar/text types could not support embedded nulls even
without the I/O problem, because they depend on C library routines like
strcoll(), and those routines don't support strings with embedded nulls.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2001-02-04 14:31:44 syslog logging setup broken?
Previous Message Tom Lane 2001-02-03 20:06:31 Re: psql & "unexpected EOF on client connection"