From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: justin@devuyst.com
Subject: any() and ilk wrt to what they accept
Date: Thu, 08 Aug 2019 15:01:47 +0000
Message-ID: <156527650771.8639.12036785429169652776@wrigleys.postgresql.org> (raw)
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/11/functions-comparisons.html
Description:
I recently wanted to do something like "not($col like
all($subquery_that_returns_multiple_values))"
but wasted quite a bit of time trying to debug why it was erroring. Perhaps
the error message or the docs could be clearer?
The error was:
<snip>
ERROR: operator does not exist: text ~~ text[]
LINE 4: and not(t.render_json::text like all(
^
HINT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.
</snip>
which confused me because it seems like the docs say all() takes "something
that returns a pg array" here:
<snip>
expression operator ALL (array expression)
The right-hand side is a parenthesized expression, which must yield an array
value.
</snip>
But I eventually found out that all() takes a pg array or a subquery but not
a subquery that returns a pg array.
To fix my query I had to do remove the array_agg() in the subquery.
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-docs@postgresql.org
Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, justin@devuyst.com
Subject: Re: any() and ilk wrt to what they accept
In-Reply-To: <156527650771.8639.12036785429169652776@wrigleys.postgresql.org>
* 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