Re: Using pl/pgsql or sql for in/out functions for types
| От | Tom Lane |
|---|---|
| Тема | Re: Using pl/pgsql or sql for in/out functions for types |
| Дата | |
| Msg-id | 4600.987180612@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Using pl/pgsql or sql for in/out functions for types (John Havard <enigma@sevensages.org>) |
| Ответы |
Re: Using pl/pgsql or sql for in/out functions for types
|
| Список | pgsql-general |
John Havard <enigma@sevensages.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
В списке pgsql-general по дате отправления: