postgresql/contrib/lo/lo.sql.in
Tom Lane 5bb2300b59 Revise handling of oldstyle/newstyle functions per recent discussions
in pghackers list.  Support for oldstyle internal functions is gone
(no longer needed, since conversion is complete) and pg_language entry
'internal' now implies newstyle call convention.  pg_language entry
'newC' is gone; both old and newstyle dynamically loaded C functions
are now called language 'C'.  A newstyle function must be identified
by an associated info routine.  See src/backend/utils/fmgr/README.
2000-11-20 20:36:57 +00:00

57 lines
1.2 KiB
MySQL

--
-- PostgreSQL code for LargeObjects
--
-- $Id: lo.sql.in,v 1.5 2000/11/20 20:36:55 tgl Exp $
--
--
-- Create the data type
--
-- used by the lo type, it takes an oid and returns an lo object
create function lo_in(opaque)
returns opaque
as 'MODULE_PATHNAME'
language 'c';
-- used by the lo type, it returns the oid of the object
create function lo_out(opaque)
returns opaque
as 'MODULE_PATHNAME'
language 'c';
-- finally the type itself
create type lo (
internallength = 4,
externallength = variable,
input = lo_in,
output = lo_out
);
-- this returns the oid associated with a lo object
create function lo_oid(lo)
returns oid
as 'MODULE_PATHNAME'
language 'c';
-- 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';
-- This is used in triggers
create function lo_manage()
returns opaque
as 'MODULE_PATHNAME'
language 'C';
-- This allows us to map lo to oid
--
-- eg:
-- create table a (image lo);
-- select image::oid from a;
--
create function oid(lo) returns oid as 'select lo_oid($1)' language 'sql';