Re: [GENERAL] Import file into bytea field in SQL/plpgsql?

2008-03-05 Thread Richard Huxton
Erwin Brandstetter wrote: Hi! What I want to do: Import a file from the file system into a bytea field of a table. Now, I could copy over from pg_largeobject: And create a large object and export from there as above. But that seems unnecessarily complex, and .. well .. stupid. There

Re: [GENERAL] Import file into bytea field in SQL/plpgsql?

2008-03-05 Thread Erwin Brandstetter
On Mar 5, 10:20 am, [EMAIL PROTECTED] (Richard Huxton) wrote: Erwin Brandstetter wrote: Hi! What I want to do: Import a file from the file system into a bytea field of a table. (...) Not that I know of. It's simple enough to do from the application side of things of course (well, in most

Re: [GENERAL] Import file into bytea field in SQL/plpgsql?

2008-03-05 Thread Douglas McNaught
On 3/5/08, Erwin Brandstetter [EMAIL PROTECTED] wrote: The whole concept behind large objects is a bit off. Since we have TOAST tables, it is of limited use to store large objects away in a system table. It would be useful to have (additional) functions like: lo_import(text) RETURNS

[GENERAL] Import file into bytea field in SQL/plpgsql?

2008-03-04 Thread Erwin Brandstetter
Hi! What I want to do: Import a file from the file system into a bytea field of a table. I know how to do it with large objects: INSERT INTO mytable(oid_fld) VALUES (lo_import('/mypath/myfile')); And export from there: SELECT lo_export(oid_fld, '/mypath/myfile2') FROM mytable WHERE some