Hi I want to create a function which returns a user defined type. After the function is created I want to be able to update the type to something else, so that the function uses the new type eg.
CREATE TYPE my_type AS ("Column1" text, "Column2" text);
CREATE OR REPLACE FUNCTION my_fucntion()
RETURNS SETOF my_type
bla
bla
blah
ALTER TYPE my_type AS ("Name" text, "Address" text)
Is this possible? the alterations will always only be the name of the column not the actual data format, that will always be the same.
EDIT: Well the thing is I have 2 scripts one which is generic and must be installed as is with no changes. It has to be installed in multiple places. The second is a sort of config script.
In the generic script I create a function which returns a type of what I wanted to define in the config script.
I thought to install the config script first but I can't as I need to perform some Inserts based on the functions which are in generic script.
Thanks