Re: Storing images in PG?

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Andrew Snow <andrew(at)modulus(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Storing images in PG?
Date: 2001-08-16 17:36:23
Message-ID: 200108161736.f7GHaNs02256@jupiter.us.greatbridge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)Yahoo(dot)com #

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michelle Murrain 2001-08-16 17:41:34 OBDC Error
Previous Message Jeremy Hansen 2001-08-16 17:33:37 race conditions in my sequences