Re: automatic value conversion - Mailing list pgsql-general

From Tom Lane
Subject Re: automatic value conversion
Date
Msg-id 7471.1174759711@sss.pgh.pa.us
Whole thread Raw
In response to automatic value conversion  (Sebastian Boehm <pg@seb.exse.net>)
Responses Re: automatic value conversion  (Sebastian Boehm <pg@seb.exse.net>)
List pgsql-general
Sebastian Boehm <pg@seb.exse.net> writes:
> the functions function_in and function_out should be called
> automatically on select or insert / update.
> How can I change the table definition to use function_in and
> function_out transparently for me (as if the table had a text colum)

You would have to create a new data type and make those functions
be the I/O functions of the type.

It sorta looks to me like you are reinventing the concept of an ENUM
column.  This has been done before --- see enumkit
http://archives.postgresql.org/pgsql-hackers/2005-10/msg01243.php
as well as the currently pending patch to integrate the feature
into core Postgres.

            regards, tom lane

pgsql-general by date:

Previous
From: Sebastian Boehm
Date:
Subject: automatic value conversion
Next
From: Sebastian Boehm
Date:
Subject: Re: automatic value conversion