Re: CREATE TYPE in Postgres 7.3.4

From: Joe Conway <mail(at)joeconway(dot)com>
To: Alex Page <alex(dot)page(at)cancer(dot)org(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: CREATE TYPE in Postgres 7.3.4
Date: 2003-11-27 15:48:46
Message-ID: 3FC61CDE.80302@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2003-11-27 15:50:56 Re: passing function's output into C function
Previous Message Andrew Sullivan 2003-11-27 15:40:56 Re: Postgresql on file system EXT2 or EXT3