On Sat, Mar 4, 2023 at 10:05 PM Ron wrote:
>
> Ugh. It's a long and hairy query that would be a nightmare in a format
> statement.
>
>
Assuming you can pass this thing into the crosstab function in the first
place you must already have put it into a string. Changing "crosstab" to
"format", plop
On 3/4/23 19:32, David G. Johnston wrote:
On Sat, Mar 4, 2023 at 5:20 PM Ron wrote:
But crosstab takes text strings as parameters. How then do you use \set
variables in crosstab queries?
You need to dynamically write the textual query you want to send to the
crosstab function. In
On 3/4/23 19:22, Tom Lane wrote:
Ron writes:
According to
https://www.postgresql.org/docs/12/app-psql.html#APP-PSQL-VARIABLES and
experience, variables don't interpolate inside of string literals:
"
Variable interpolation will not be performed within quoted SQL literals and
identifiers. Therefo
On Sat, Mar 4, 2023 at 5:20 PM Ron wrote:
>
> But crosstab takes text strings as parameters. How then do you use \set
> variables in crosstab queries?
>
>
You need to dynamically write the textual query you want to send to the
crosstab function. In particular that means writing it using "format
Ron writes:
> According to
> https://www.postgresql.org/docs/12/app-psql.html#APP-PSQL-VARIABLES and
> experience, variables don't interpolate inside of string literals:
> "
> Variable interpolation will not be performed within quoted SQL literals and
> identifiers. Therefore, a construction su
According to
https://www.postgresql.org/docs/12/app-psql.html#APP-PSQL-VARIABLES and
experience, variables don't interpolate inside of string literals:
"
Variable interpolation will not be performed within quoted SQL literals and
identifiers. Therefore, a construction such as ':foo' doesn't