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