Long story short, I have a function written by plpgsql in postgres, this function would do me a favor to generate a 'select * from crosstab.....'
statement in the result so that I don't have to manually type the hundreds of column names for pivot table in this statement. So now if I just copy paste this statement in another query tool and run it, I can get the pivot table generated in the output. However, as you spotted, this process involves man work thus not automatic, I have tried some like EXECUTE function('which returns the statement I want')
, but I have not yet found the solution...
In order to clarify what I am asking, here I can express in a very simple example.
select 1+1
returns 2
now i would love to use another key word i.e. EXECUTE 'select 1+1'
to return 2 as well, how can I do this? I have been searching for a while, please help. Thanks.