pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedbug in working with TEXT constants ?
3+ messages / 3 participants
[nested] [flat]
* bug in working with TEXT constants ?
@ 2003-10-28 11:53 sad <sad@bankir.ru>
0 siblings, 2 replies; 3+ messages in thread
From: sad @ 2003-10-28 11:53 UTC (permalink / raw)
To: pgsql-sql
Good day.
AFAIK PostgreSQL provides the type TEXT with 4-byte prefix length
which is distinct to C's zero-terminated (char *)
That's very good.
Then I expect natural possibility to store texts having zero characters.
try
SELECT 'abc\0de';
SELECT length('abc\0de');
or insert such a value into another table and then select....
you'll see a classical result just like you are using (char *).
i suppose it is a little bug deep inside like using a memcpy() or such...
Am i wrong?
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: bug in working with TEXT constants ?
@ 2003-10-28 15:11 Stephan Szabo <sszabo@megazone.bigpanda.com>
parent: sad <sad@bankir.ru>
1 sibling, 0 replies; 3+ messages in thread
From: Stephan Szabo @ 2003-10-28 15:11 UTC (permalink / raw)
To: sad <sad@bankir.ru>; +Cc: pgsql-sql
On Tue, 28 Oct 2003, sad wrote:
> Good day.
>
> AFAIK PostgreSQL provides the type TEXT with 4-byte prefix length
> which is distinct to C's zero-terminated (char *)
> That's very good.
> Then I expect natural possibility to store texts having zero characters.
If you want to store zero characters (or binary data) you
probably want bytea not text.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: bug in working with TEXT constants ?
@ 2003-10-28 15:41 Tom Lane <tgl@sss.pgh.pa.us>
parent: sad <sad@bankir.ru>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2003-10-28 15:41 UTC (permalink / raw)
To: sad <sad@bankir.ru>; +Cc: pgsql-sql
sad <sad@bankir.ru> writes:
> Then I expect natural possibility to store texts having zero characters.
You expect wrong; we don't support embedded nulls in text values, nor in
literal strings. You can store nulls in BYTEA fields, but you have to
use bytea's escaping conventions to represent the value in SQL commands,
eg, 'foo\\000bar'.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-10-28 15:41 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-28 11:53 bug in working with TEXT constants ? sad <sad@bankir.ru>
2003-10-28 15:11 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
2003-10-28 15:41 ` 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