pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-sql@postgresql.org
Subject: Re: Using substr with user defined types
Date: Thu, 18 May 2000 10:52:57 -0400
Message-ID: <23390.958661577@sss.pgh.pa.us> (raw)
In-Reply-To: <m12sNwa-000AXnC@druid.net>
References: <m12sNwa-000AXnC@druid.net>

darcy@druid.net (D'Arcy J.M. Cain) writes:
> create function chkpass_rout(opaque)
>     returns opaque
>     as '/usr/pgsql/modules/chkpass.so'
>     language 'c';

> Here is what happens.

> soccer=> select chkpass_rout('hello'::chkpass);
> ERROR:  typeidTypeRelid: Invalid type - oid = 0

Functions that you intend to invoke as ordinary functions shouldn't have
inputs or outputs declared "opaque", because the expression evaluation
code won't have any idea what to do.  When you are building functions
that will be the input or output converters for a datatype, you can read
"opaque" as meaning "C string", so for example the input converter takes
opaque and returns your type.  But otherwise you don't want to be using
opaque.  Perhaps what you wanted here was
"create function chkpass_rout(chkpass) returns text".

I'd like to see "opaque" eliminated from Postgres, because it's
unhelpfully named and is used to cover several distinct purposes that
would be better served with distinct names.  Might create too much of
a backwards compatibility problem though :-(

			regards, tom lane



view thread (10+ messages)  latest in thread

Message-ID: <23390.958661577@sss.pgh.pa.us>
Permalink:  ../23390.958661577@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23390.958661577@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: Using substr with user defined types
  In-Reply-To: <23390.958661577@sss.pgh.pa.us>
  References: <m12sNwa-000AXnC@druid.net> <23390.958661577@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox