I have a base table with many derived tables in PostgreSQL 9.2. For each derived table there is a function that returns "SETOF derived_table". These functions are generated code and they don't need to know the derived column names, because they simply call
SELECT *
FROM derived_table
WHERE [some conditions on base columns]
I now want the functions to modify the returned values for some of the base columns, but continue to return all the derived columns, ie. something like this:
SELECT 'something else' AS base_col1, base_col2, base_col3, [all derived columns]
FROM derived_table
WHERE ...
Is there a way to express this in Postgres without listing all derived column names?
Alternatively, I could return the data I want in separate columns if only there was a way to define the function to return something like "SETOF my_special_column+derived_table". Again, I want to somehow avoid listing all the derived column names, so the functions can still be easily auto-generated.