I am about to learn postgresql and i ran in some kind of a problem. I want to have most of my connection from website to db through stored procedure(functions). I have about 20 functions so far where 5 of those functions returned exactly the same table with columns i.e:
create or replace function my_Function( t text )
returns setof table(uid uuid,testText text, randomInt int ...)
...
since table(uid uuid,testText text, randomInt int ...) repeated itself 5 times i figured out that i could use composite type to return the same type of data from my functions, so if i need to return an extra column i could just change my composite type and voila, all 5 functions should return same columns.
Unfortunately thats not how that works, as soon as i added a new column to my composite type all the functions which used my composite type broke with saem error:
Final statement returns too few columns
which makes sense because i dont select an extra column to fit the composite type.
Are there any way to tell which functions use a composite type as return type? Are there any way to force composite type to fill in blanks for newly created column (if not, then i can as well use the table(...) return type, because it dont solve the redundancy problem which i try to avoid)?