Skip to content

Commit 471d558

Browse files
committed
Adjust psql \d query to avoid use of @> operator.
It seems that the parray_gin extension has seen fit to introduce a "text[] @> text[]" operator, which conflicts with the core "anyarray @> anyarray" operator, causing ambiguous-operator failures if the input arguments are coercible to text[] without being exactly that type. This strikes me as a bad idea, but it's out there and people use it. As of v10, that breaks psql's query that tries to test "pg_statistic_ext.stxkind @> '{d}'", since stxkind is char[]. The best workaround seems to be to avoid use of that operator. We can use a scalar-vs-array test "'d' = any(stxkind)" instead; that's arguably more readable anyway. Per report from Justin Pryzby. Backpatch to v10 where this query was added. Discussion: https://postgr.es/m/20171022181525.GA21884@telsasoft.com
1 parent 7c98159 commit 471d558

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bin/psql/describe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,8 +2423,8 @@ describeOneTableDetails(const char *schemaname,
24232423
" FROM pg_catalog.unnest(stxkeys) s(attnum)\n"
24242424
" JOIN pg_catalog.pg_attribute a ON (stxrelid = a.attrelid AND\n"
24252425
" a.attnum = s.attnum AND NOT attisdropped)) AS columns,\n"
2426-
" (stxkind @> '{d}') AS ndist_enabled,\n"
2427-
" (stxkind @> '{f}') AS deps_enabled\n"
2426+
" 'd' = any(stxkind) AS ndist_enabled,\n"
2427+
" 'f' = any(stxkind) AS deps_enabled\n"
24282428
"FROM pg_catalog.pg_statistic_ext stat "
24292429
"WHERE stxrelid = '%s'\n"
24302430
"ORDER BY 1;",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy