"Daniel Verite" <daniel@manitou-mail.org> writes:
> I want to suggest a client-side \pivot command in psql, implemented
> in the attached patch.
> \pivot takes the current query in the buffer, execute it and
> display it pivoted by interpreting the result as:
> column1 => row in pivoted output
> column2 => column in pivoted output
> column3 => value at (row,column) in pivoted ouput
I can see the value of a feature like this, but doing it in psql sure
seems like the wrong place. It would be unavailable to anything
except interactive use.
Is there a way to implement pivoting as a set-returning function?
regards, tom lane