| From: | Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Hugh Mandeville <hughmandeville(at)hotmail(dot)com>, pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Re: Re: binary data |
| Date: | 2001-06-22 15:35:37 |
| Message-ID: | 20010622173537.A14265@ara.zf.jcu.cz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/
C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2001-06-22 15:40:17 | Re: Re: Re: binary data |
| Previous Message | Alex Pilosov | 2001-06-22 15:34:08 | Re: View performance question |