From: Thomas Kellerer <shammat@gmx.net>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Need query
Date: Sun, 18 Jul 2021 16:54:08 +0200
Message-ID: <efdb82b5-5981-10bc-c087-af73282b9bfc@gmx.net> (raw)
In-Reply-To: <CAKUTCr5miZfGQm_iV2oeWSu48_oZWNbPctB7m1WKaCVXo4_z9w@mail.gmail.com>
References: <CAK_Ha4xccRpDqzC-M5NWXn1+saRXbC_PVn3Rw0Lo=qBHxQDhuw@mail.gmail.com>
<d3309e65-ddff-439e-49a1-7a42a0479001@gmx.net>
<CAKUTCr5miZfGQm_iV2oeWSu48_oZWNbPctB7m1WKaCVXo4_z9w@mail.gmail.com>
Caetano Traina Junior schrieb am 18.07.2021 um 15:19:>
>> Em sáb., 17 de jul. de 2021 às 05:33, Thomas Kellerer <shammat@gmx.net <mailto:shammat@gmx.net>> escreveu:
>> And before you ask: it's not really possible to make this dynamic, so that the number
>> of columns "automagically" increases when you have more fruits. One fundamental
>> restriction of the SQL language is that the number and types of all columns
>> must be known to the database when the query is parsed. It can't change
>> the columns as a result of the query itself.
> Nonetheless, it is always possible to write a dynamic SQL (and best
> yet, inside a plpgsql function) to "automagically handle more
> fruits..."
Even if you create a function that uses dynamic SQL, you still have to
specify each output column "manually" when calling the function.
So that doesn't really buy you anything.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: shammat@gmx.net, pgsql-admin@lists.postgresql.org
Subject: Re: Need query
In-Reply-To: <efdb82b5-5981-10bc-c087-af73282b9bfc@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox