From: Karel Zak <zakkr@zf.jcu.cz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Hugh Mandeville <hughmandeville@hotmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Re: Re: binary data
Date: Fri, 22 Jun 2001 17:35:37 +0200
Message-ID: <20010622173537.A14265@ara.zf.jcu.cz> (raw)
In-Reply-To: <3791.993219752@sss.pgh.pa.us>
References: <Pine.BSO.4.10.10106201342060.20262-100000@spider.pilosoft.com>
<9gtovc$mnr$1@news.tht.net>
<3791.993219752@sss.pgh.pa.us>
On Fri, Jun 22, 2001 at 10:22:32AM -0400, Tom Lane wrote:
> He did say the rules for escaping things are tricky ;-). You need to
> double the backslashes, because interpretation of the string literal
> takes off one level of backslashing before bytea ever sees it:
>
> regression=# INSERT INTO log (data) VALUES ('null \\000 null');
> INSERT 273181 1
> regression=# SELECT octet_length(data), data FROM log;
> octet_length | data
> --------------+------------------------------
> 10 | plain text
> 19 | special chars \012 \001 \002
> 5 | null
> 11 | null \000 null
> (4 rows)
And what use some better encoding if you have a lot of binary chars
in data. For example base64, that code 2 chars to 3 instead \\000
that encode 1 char to 4.
Karel
--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/
C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
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: zakkr@zf.jcu.cz, tgl@sss.pgh.pa.us, hughmandeville@hotmail.com
Subject: Re: Re: Re: binary data
In-Reply-To: <20010622173537.A14265@ara.zf.jcu.cz>
* 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