1CREATE EXTENSION lo; 2 3CREATE TABLE image (title text, raster lo); 4 5CREATE TRIGGER t_raster BEFORE UPDATE OR DELETE ON image 6 FOR EACH ROW EXECUTE PROCEDURE lo_manage(raster); 7 8SELECT lo_create(43213); 9SELECT lo_create(43214); 10 11INSERT INTO image (title, raster) VALUES ('beautiful image', 43213); 12 13SELECT lo_get(43213); 14SELECT lo_get(43214); 15 16UPDATE image SET raster = 43214 WHERE title = 'beautiful image'; 17 18SELECT lo_get(43213); 19SELECT lo_get(43214); 20 21-- test updating of unrelated column 22UPDATE image SET title = 'beautiful picture' WHERE title = 'beautiful image'; 23 24SELECT lo_get(43214); 25 26DELETE FROM image; 27 28SELECT lo_get(43214); 29 30DROP TABLE image; 31