in reply to PostgreSQL and binary data
Then do your inserts, selects and deletesCREATE TABLE image { item_id INTEGER NOT NULL, picture OID, CONSTRAINT image_pk PRIMARY KEY(item_id), CONSTRAINT image_item_id_fk FOREIGN KEY(item_id) REFERENCES item(i +tem_id) };
WARNING: this code is untested, but double checked FYI: why I suggest avoiding BLOBs. Not portable to other RDBMSs Filesystems are much better at handling files Slows your DB down during BLOB access, usally only slightly a general big pain in the A** grepINSERT INTO image VALUES (3, lo_import('/tmp/image_name.jpg')); SELECT lo_export(picture, '/tmp/image_name.jpg') FROM image WHERE item +_id = 3; to delete: SELECT lo_unlink(picture) FROM image WHERE item_id = 3;
grep> cd pub grep> more beer
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: PostgreSQL and binary data
by rob_au (Abbot) on Dec 25, 2001 at 13:40 UTC |