Opaque not working as documented

From: Steven Blundy <sblundy(at)CLEMSON(dot)EDU>
To: pgsql-novice(at)postgresql(dot)org
Subject: Opaque not working as documented
Date: 2002-06-19 20:27:13
Message-ID: 3D10E921.4040308@clemson.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi, I'm having an odd problem with CREATE FUNCTION. Here are my statements:

CREATE FUNCTION ENCODE_BURY_TYPE (OPAQUE) RETURNS INT
AS 'SELECT CASE
WHEN $1 = \'EXACT\' THEN 1
WHEN $1 = \'APPROX\' THEN 2
WHEN $1 = \'PSUEDO\' THEN 3
ELSE NULL
END;'
LANGUAGE 'SQL';

CREATE FUNCTION DECODE_BURY_TYPE (INT) RETURNS OPAQUE
AS 'SELECT CASE
WHEN $1 = 1 THEN \'EXACT\'
WHEN $1 = 2 THEN \'APPROX\'
WHEN $1 = 3 THEN \'PSUEDO\'
ELSE \'NONE\'
END;'
LANGUAGE 'SQL';

CREATE TYPE BURY_TYPE (
INPUT = ENCODE_BURY_TYPE,
OUTPUT = DECODE_BURY_TYPE,
INTERNALLENGTH = 16
);

This results in the error messages

ERROR: SQL functions cannot have arguments of type "opaque"
ERROR: SQL functions cannot return type "opaque"

Changing opaque to text results in the CREATE FUNCTION statements
working, while the CREATE TYPE statements throw a fit.

I suspect a configuration problem, but I have no idea where to look and
searches on google and the list archives haven't turned up anything. I'm
running the redhat rpms for Postgresql 7.2.1 on redhat 7.3.

Thank you,

Steve

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Ansley 2002-06-19 22:15:36 Need to install libpq++
Previous Message Aarni Ruuhimäki / Megative Tmi / KYMI.com 2002-06-19 18:41:49 Re: ODBC Error