How to insert zeros into a bytea column?

From: Iklódi Lajos <il(at)mithrandir(dot)hu>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: How to insert zeros into a bytea column?
Date: 2002-02-23 20:16:31
Message-ID: 3C77F89F.68BFA64@mithrandir.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Benoit Menendez 2002-02-23 20:20:08 More open source database comparison...
Previous Message Roberto Mello 2002-02-23 19:03:31 Re: How do I return more than one value in a postgresql pl/pgsql procedure?