Re: CREATE TYPE in Postgres 7.3.4

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: CREATE TYPE in Postgres 7.3.4
Дата
Msg-id 3FC61CDE.80302@joeconway.com
обсуждение исходный текст
Ответ на CREATE TYPE in Postgres 7.3.4  (Alex Page <alex.page@cancer.org.uk>)
Ответы Re: CREATE TYPE in Postgres 7.3.4  (Alex Page <alex.page@cancer.org.uk>)
Список pgsql-general
Alex Page wrote:

[...creates enum_gender_in and enum_gender_out as PL/pgSQL functions...]

>   CREATE TYPE enum_gender (
>     INPUT = enum_gender_in,
>     OUTPUT = enum_gender_out,
>     INTERNALLENGTH = 2,
>     PASSEDBYVALUE
>   );
>
> According to the Postgres documentation, when I create the input
> function, it should create a placeholder entry in pg_type for
> enum_gender and wait for the type to be created. However, when I execute
> the CREATE FUNCTION statement, I get:

According to the docs, you cannot use PL/pgSQL functions for I/O
conversion functions. See
http://www.postgresql.org/docs/current/static/plpgsql.html#PLPGSQL-OVERVIEW
where it says:
    "Except for input/output conversion and calculation functions for
     user-defined types, anything that can be defined in C language
     functions can also be done with PL/pgSQL."

In general, I don't think I/O functions can be anything other than C
functions.

On this page
http://www.postgresql.org/docs/current/static/sql-createtype.html
it says:
    "The support functions input_function and output_function are
     required, while the functions receive_function and send_function are
     optional. Generally these functions have to be coded in C or another
     low-level language."

Joe


В списке pgsql-general по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: Postgresql on file system EXT2 or EXT3
Следующее
От: Joe Conway
Дата:
Сообщение: Re: passing function's output into C function