large objects issue

From: "Jason Priebe" <priebe(at)mi-corporation(dot)com>
To: <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: large objects issue
Date: 2004-05-20 17:08:08
Message-ID: 007c01c43e8d$061c5f10$80a8a8c0@micodev.micorporation.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers-win32

Congratulations to the team on getting so far with the Win32 port.
It's looking good. I was able to install using the simple instructions
and got some databases built.

One thing I ran into is that when I tried to run the lo.sql script
that ships with RedHat, I got the following errors. Admittedly, I don't
fully understand the lo.sql script, but I thought this report might be
useful in some way.

$ psql -d CUST -f lo.sql
SET
SET
psql.exe:lo.sql:20: NOTICE: type "lo" is not yet defined
DETAIL: Creating a shell type definition.
psql.exe:lo.sql:20: ERROR: could not access file "$libdir/lo": No such
file or
directory
psql.exe:lo.sql:26: ERROR: type lo does not exist
psql.exe:lo.sql:34: ERROR: function lo_in(cstring) does not exist
psql.exe:lo.sql:40: ERROR: type lo does not exist
psql.exe:lo.sql:49: ERROR: type lo does not exist
psql.exe:lo.sql:50: ERROR: source data type lo does not exist
psql.exe:lo.sql:57: NOTICE: type "lo" is not yet defined
DETAIL: Creating a shell type definition.
psql.exe:lo.sql:57: ERROR: could not access file "$libdir/lo": No such
file or
directory
psql.exe:lo.sql:58: ERROR: target data type lo does not exist
psql.exe:lo.sql:64: ERROR: could not access file "$libdir/lo": No such
file or
directory

----------------------------------------------------------------------
lo.sql follows
----------------------------------------------------------------------
-- PostgreSQL code for LargeObjects
--
-- lo.sql.in,v 1.8.2.1 2003/01/03 15:43:33 inoue Exp
--
--
-- Create the data type
--

-- used by the lo type, it takes an oid and returns an lo object

-- Adjust this setting to control where the objects get created.
SET search_path = public;

SET autocommit TO 'on';

CREATE FUNCTION lo_in(cstring)
RETURNS lo
AS '$libdir/lo'
LANGUAGE 'C' IMMUTABLE;

-- used by the lo type, it returns the oid of the object
CREATE FUNCTION lo_out(lo)
RETURNS cstring
AS '$libdir/lo'
LANGUAGE 'C' IMMUTABLE;

-- 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 '$libdir/lo'
LANGUAGE 'C' IMMUTABLE;

-- same function, named to allow it to be used as a type coercion, eg:
-- CREATE TABLE a (image lo);
-- SELECT image::oid FROM a;
--
CREATE FUNCTION oid(lo)
RETURNS oid
AS '$libdir/lo', 'lo_oid'
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 '$libdir/lo'
LANGUAGE 'C' IMMUTABLE;
CREATE CAST (oid as lo) WITH FUNCTION lo(oid) AS IMPLICIT;

-- This is used in triggers
CREATE FUNCTION lo_manage()
RETURNS trigger
AS '$libdir/lo'
LANGUAGE 'C';1Gk

Jason Priebe
Mi-Co
http://www.mi-corporation.com/

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Gary Doades 2004-05-20 19:30:59 Win32 port CPU times
Previous Message Magnus Hagander 2004-05-19 15:15:27 Re: Changing postgresql.conf values without restarting the postmaster?