Re: Storing images in PG? - Mailing list pgsql-general

From Jan Wieck
Subject Re: Storing images in PG?
Date
Msg-id 200108161736.f7GHaNs02256@jupiter.us.greatbridge.com
Whole thread Raw
In response to RE: Storing images in PG?  ("Andrew Snow" <andrew@modulus.org>)
List pgsql-general
Andrew Snow wrote:
>
>
> > I have found (and confirmed by studying the PostgreSQL
> > source) that to reliably insert arbitrary binary data into a
> > bytea column there are only 3 characters which need to be
> > escaped: \000, \047 ( ' ), \134 ( \ ). Here's the PHP
> > function that I've been using:
>
>
> Postgresl, in treating things as strings, handles \000 as NULL as an end
> of string.
>
>  select 'abc\000def' as hehehe;
>  hehehe
> --------
>  abc
> (1 row)

    You forgot to quote the \ and cast it to bytea.

>
>
> How do you get the data back from a query, with all the nulls in it?
>
>
> - Andrew
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


pgsql-general by date:

Previous
From: "Joe Conway"
Date:
Subject: Re: Storing images in PG?
Next
From: Tom Lane
Date:
Subject: Re: Roll Back dont roll back counters