On 2024-03-28 23:27 +0100, M Sarwar wrote:
> Numbers of returning columns will vary dynamically. Based on that
> SELECT * FROM func() AS (c1 integer, c2 text) is not applicable in my
> case.
Dynamic table structures are hard to do in SQL, one of the reasons why
document databases and the NoSQL movement exist. So why use crosstab
when it doesn't fit your use case? Can you achieve the same with a view
or function that returns jsonb like it has been suggested[1] to you
before? Does the query even have to be implemented inside the database?
[1] https://www.postgresql.org/message-id/CAJJx%2BiUFyTAN9F-C7xBx0sunr08aPvF_EnkGiHm7SP2mhakpqQ%40mail.gmail.com
--
Erik