Search Postgresql Archives

automatic value conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux