| From: | Greg Steffensen <greg(dot)steffensen(at)gmail(dot)com> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | plpythonu and bytea | 
| Date: | 2005-07-02 20:49:23 | 
| Message-ID: | 438a2361050702134931e1fff4@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Hey, I'm trying to write some plpython procedures that read binary data from 
images on the disk and store it in bytea fields. I'm basically trying to 
write a plpython procedure that accepts a varchar and returns a bytea, with 
these procedure contents:
data = file(args[0]).read()
return data
(The actual procedure will have more in it, but that's the tricky part). But 
the returned data is always severely truncated. Is returning a bytea from 
plpython impossible, or is there some way I should escape the data string? 
I've tried using the built in encode and decode functions, but they don't 
seem to help. If worse comes to worse, I can store the base64 encoded 
version, of course, but I'd rather not do that. Any ideas?
Greg
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Pratt | 2005-07-02 21:55:25 | Re: Transparent i18n? | 
| Previous Message | David Pratt | 2005-07-02 20:00:50 | Re: Transparent i18n? |