Re: Using pl/pgsql or sql for in/out functions for types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Havard <enigma(at)sevensages(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using pl/pgsql or sql for in/out functions for types
Date: 2001-04-13 16:50:12
Message-ID: 4600.987180612@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John Havard <enigma(at)sevensages(dot)org> writes:
> Is there anyway to do this without having to resort to writing the
> functions in C or some other language?

You really cannot write datatype I/O functions in anything but C,
because the I/O functions have to deal in C-style strings, which are
not a SQL datatype; so there is no way to describe the necessary
behavior in any PL language.

There has been some talk of promoting "C string" to be at least a
second-class SQL datatype (on the order of being able to declare
functions that take or return them, but not use them as a column
datatype). Hasn't happened yet though.

> Why doesn't CREATE FUNCTION complain about plpgsql functions not being
> able to accept the opaque type as an argument?

Because it makes no assumptions about what abilities PL languages might
have. The PLs are plug-ins, remember.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-04-13 17:03:04 Re: pg_dump dying (and VACUUM ANALYZE woes)...
Previous Message Tom Lane 2001-04-13 16:40:15 Re: Deadlock detected