From: | Sebastian Boehm <pg(at)seb(dot)exse(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | automatic value conversion |
Date: | 2007-03-24 16:48:42 |
Message-ID: | C35DBBFA-7318-48B1-9FF6-0EF328ED9EDD@seb.exse.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
currently I do this:
INSERT INTO table1 (row1) VALUES ( function_in('argument1','myvalue'))
and
select function_out('argument1',row1) from table1; (which gives
'myvalue' again)
funtion_out(text,int) returns text
funtion_in(text,text) returns int
the table looks like this:
create table table1
(
row1 integer;
)
instead of the select and insert statements above I want to do this:
INSERT INTO table1 (row1) VALUES ( 'myvalue' )
and
select row1 from table1; (which gives 'myvalue' again, but in reality
some integer is stored in the database)
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)
(remember function_in and function_out convert von int to text and
have an addional fixed text argument)
Thank you very much for your Help !!
Sebastian
From | Date | Subject | |
---|---|---|---|
Next Message | Patrick TJ McPhee | 2007-03-24 17:27:42 | Re: Lifecycle of PostgreSQL releases |
Previous Message | Alvaro Herrera | 2007-03-24 12:47:27 | Re: Lifecycle of PostgreSQL releases |