Table 3-25. Large Object Functions
| Name | Return type | Description |
|---|---|---|
| lo_import(filename) | oid | Import LOB |
| lo_export(filename) | oid | Export LOB |
There are two built-in registered functions, lo_import and lo_export, that can be used in SQL queries to omport and export large objects (LOBs). The filename argument specifies the UNIX pathname of the file to be imported as a large object (or the location of the file the LOB should be exported to).
They can be used as follows:
CREATE TABLE image (
name text,
raster oid
);
INSERT INTO image (name, raster);
VALUES ('beautiful image', lo_import('/etc/motd'));
SELECT lo_export(image.raster, 'tmp/motd') from image
WHERE name = 'beautiful image'; |