On Tue, Sep 4, 2012 at 10:39 AM, punnoose <punnoose.pj@xxxxxxxxxxxxxxxxxx> wrote: > hi all > How could i use crostab to display variable number of columns. in the output > There could be variable number of columns > Regards > Punnoose No. The workaround I use is to write a query generator in pl/pgsql (you can also do it in the client) which queries the specific columns that are going to be crosstabbed and generates a query textually. That query is returned to the client and executed, essentially bypassing the restriction. The way functions are implemented in postgres forces them to have a rigidly defined set of output columns...it's annoying and everybody hates it but that's the way things have to be for various reasons. Looking to the future, stored procedures might not end up having this restriction depending on how they are implemented. Now that LATERAL and standalone backends are or are in the process of being knocked out I consider stored procedures to be one of the great unsolved features of postgres. merlin -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general