Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id 84F8247586D for ; Sat, 23 Feb 2002 16:03:54 -0500 (EST) Received: from [192.168.5.2] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.4.8) with ESMTP-TLS id 110334; Sat, 23 Feb 2002 13:03:38 -0800 Message-ID: <3C7803C7.4090207@joeconway.com> Date: Sat, 23 Feb 2002 13:04:07 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.8) Gecko/20020204 X-Accept-Language: en-us MIME-Version: 1.0 To: =?ISO-8859-2?Q?Ikl=F3di?= Lajos Cc: "pgsql-sql@postgresql.org" Subject: Re: How to insert zeros into a bytea column? References: <3C77F89F.68BFA64@mithrandir.hu> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Archive-Number: 200202/343 X-Sequence-Number: 6765 Iklódi Lajos wrote: > 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) You should double up on the backslashes: test=# CREATE TABLE test (id int4, adat bytea); CREATE test=# insert into test (id, adat) values (1, '\\100\\200\\000\\100\\200'); INSERT 82097 1 test=# select * from test; id | adat ----+---------------- 1 | @\200\000@\200 (1 row) See for more info: http://www.us.postgresql.org/users-lounge/docs/7.2/postgres/datatype-binary.html HTH, Joe