summaryrefslogtreecommitdiff
path: root/contrib/lo
diff options
context:
space:
mode:
authorHiroshi Inoue <inoue@tpf.co.jp>2002-12-31 10:22:03 +0000
committerHiroshi Inoue <inoue@tpf.co.jp>2002-12-31 10:22:03 +0000
commit9ab7ab51963f614f631cfc49de7d1943cfc5c0a3 (patch)
tree1e2bd229ab2e419b56f150766f497783b92d3f51 /contrib/lo
parent699782b69518e18c20211df315c49b8cd0dc9345 (diff)
downloadpostgresql-9ab7ab51963f614f631cfc49de7d1943cfc5c0a3.tar.gz
Add casts between lo and oid.
Diffstat (limited to 'contrib/lo')
-rw-r--r--contrib/lo/lo.sql.in14
1 files changed, 8 insertions, 6 deletions
diff --git a/contrib/lo/lo.sql.in b/contrib/lo/lo.sql.in
index 0d9f6c890d..68c0114a5f 100644
--- a/contrib/lo/lo.sql.in
+++ b/contrib/lo/lo.sql.in
@@ -1,7 +1,7 @@
--
-- PostgreSQL code for LargeObjects
--
--- $Id: lo.sql.in,v 1.8 2002/10/18 18:41:20 momjian Exp $
+-- $Id: lo.sql.in,v 1.9 2002/12/31 10:22:03 inoue Exp $
--
--
-- Create the data type
@@ -17,13 +17,13 @@ SET autocommit TO 'on';
CREATE FUNCTION lo_in(cstring)
RETURNS lo
AS 'MODULE_PATHNAME'
-LANGUAGE 'C';
+LANGUAGE 'C' IMMUTABLE;
-- used by the lo type, it returns the oid of the object
CREATE FUNCTION lo_out(lo)
RETURNS cstring
AS 'MODULE_PATHNAME'
-LANGUAGE 'C';
+LANGUAGE 'C' IMMUTABLE;
-- finally the type itself
CREATE TYPE lo (
@@ -37,7 +37,7 @@ CREATE TYPE lo (
CREATE FUNCTION lo_oid(lo)
RETURNS oid
AS 'MODULE_PATHNAME'
-LANGUAGE 'C';
+LANGUAGE 'C' IMMUTABLE;
-- same function, named to allow it to be used as a type coercion, eg:
-- CREATE TABLE a (image lo);
@@ -46,14 +46,16 @@ LANGUAGE 'C';
CREATE FUNCTION oid(lo)
RETURNS oid
AS 'MODULE_PATHNAME', 'lo_oid'
-LANGUAGE 'C';
+LANGUAGE 'C' IMMUTABLE;
+CREATE CAST (lo as oid) WITH FUNCTION oid(lo) AS IMPLICIT;
-- this allows us to convert an oid to a managed lo object
-- ie: insert into test values (lo_import('/fullpath/file')::lo);
CREATE FUNCTION lo(oid)
RETURNS lo
AS 'MODULE_PATHNAME'
-LANGUAGE 'C';
+LANGUAGE 'C' IMMUTABLE;
+CREATE CAST (oid as lo) WITH FUNCTION lo(oid) AS IMPLICIT;
-- This is used in triggers
CREATE FUNCTION lo_manage()