From: Iklódi Lajos <il@mithrandir.hu>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: How to insert zeros into a bytea column?
Date: Sat, 23 Feb 2002 21:16:31 +0100
Message-ID: <3C77F89F.68BFA64@mithrandir.hu> (raw)
Hello,
I'm inserting data into a bytea colunm which can contain zero bytes. It
seems that insertion stops at first zero:
gkk=# CREATE TABLE test (id int4, adat bytea);
CREATE
gkk=# insert into test (id, adat) values (1, '\100\200\000\100\200');
INSERT 164175 1
gkk=# select * from test;
id | adat
----+-------
1 | @\200
(1 row)
gkk=# select get_byte(adat,1) from test;
get_byte
----------
128
(1 row)
gkk=# select get_byte(adat,2) from test;
ERROR: byteaGetByte: index 2 out of range [0..1]
How to insert in a correct way?
Thanks,
Lajos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: il@mithrandir.hu
Subject: Re: How to insert zeros into a bytea column?
In-Reply-To: <3C77F89F.68BFA64@mithrandir.hu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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