Re: Like to RETURN SQL results set

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: M Sarwar <sarwarmd02(at)outlook(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Like to RETURN SQL results set
Date: 2024-03-28 22:46:04
Message-ID: hxq6kue5366iodbhhpzlfhb67ppd4s3twt43dwckelnmloul4c@j6u3hsbf4pah
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message James Pang 2024-03-29 02:05:59 cached plan must not change result type
Previous Message M Sarwar 2024-03-28 22:27:08 Re: Like to RETURN SQL results set