mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Fix incorrect pattern-match processing in psql's \det command.
listForeignTables' invocation of processSQLNamePattern did not match up with the other ones that handle potentially-schema-qualified names; it failed to make use of pg_table_is_visible() and also passed the name arguments in the wrong order. Bug seems to have been aboriginal in commit0d692a0dc9
. It accidentally sort of worked as long as you didn't inquire too closely into the behavior, although the silliness was later exposed by inconsistencies in the test queries added by59efda3e50
(which I probably should have questioned at the time, but didn't). Per bug #13899 from Reece Hart. Patch by Reece Hart and Tom Lane. Back-patch to all affected branches.
This commit is contained in:
@ -3734,7 +3734,7 @@ CREATE TABLE import_source."x 5" (c1 float8);
|
||||
ALTER TABLE import_source."x 5" DROP COLUMN c1;
|
||||
CREATE SCHEMA import_dest1;
|
||||
IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest1;
|
||||
\det+ import_dest1
|
||||
\det+ import_dest1.*
|
||||
List of foreign tables
|
||||
Schema | Table | Server | FDW Options | Description
|
||||
--------------+-------+----------+-------------------------------------------------+-------------
|
||||
@ -3790,7 +3790,7 @@ FDW Options: (schema_name 'import_source', table_name 'x 5')
|
||||
CREATE SCHEMA import_dest2;
|
||||
IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest2
|
||||
OPTIONS (import_default 'true');
|
||||
\det+ import_dest2
|
||||
\det+ import_dest2.*
|
||||
List of foreign tables
|
||||
Schema | Table | Server | FDW Options | Description
|
||||
--------------+-------+----------+-------------------------------------------------+-------------
|
||||
@ -3845,7 +3845,7 @@ FDW Options: (schema_name 'import_source', table_name 'x 5')
|
||||
CREATE SCHEMA import_dest3;
|
||||
IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest3
|
||||
OPTIONS (import_collate 'false', import_not_null 'false');
|
||||
\det+ import_dest3
|
||||
\det+ import_dest3.*
|
||||
List of foreign tables
|
||||
Schema | Table | Server | FDW Options | Description
|
||||
--------------+-------+----------+-------------------------------------------------+-------------
|
||||
@ -3901,7 +3901,7 @@ FDW Options: (schema_name 'import_source', table_name 'x 5')
|
||||
CREATE SCHEMA import_dest4;
|
||||
IMPORT FOREIGN SCHEMA import_source LIMIT TO (t1, nonesuch)
|
||||
FROM SERVER loopback INTO import_dest4;
|
||||
\det+ import_dest4
|
||||
\det+ import_dest4.*
|
||||
List of foreign tables
|
||||
Schema | Table | Server | FDW Options | Description
|
||||
--------------+-------+----------+------------------------------------------------+-------------
|
||||
@ -3910,7 +3910,7 @@ IMPORT FOREIGN SCHEMA import_source LIMIT TO (t1, nonesuch)
|
||||
|
||||
IMPORT FOREIGN SCHEMA import_source EXCEPT (t1, "x 4", nonesuch)
|
||||
FROM SERVER loopback INTO import_dest4;
|
||||
\det+ import_dest4
|
||||
\det+ import_dest4.*
|
||||
List of foreign tables
|
||||
Schema | Table | Server | FDW Options | Description
|
||||
--------------+-------+----------+-------------------------------------------------+-------------
|
||||
|
@ -879,29 +879,29 @@ ALTER TABLE import_source."x 5" DROP COLUMN c1;
|
||||
|
||||
CREATE SCHEMA import_dest1;
|
||||
IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest1;
|
||||
\det+ import_dest1
|
||||
\det+ import_dest1.*
|
||||
\d import_dest1.*
|
||||
|
||||
-- Options
|
||||
CREATE SCHEMA import_dest2;
|
||||
IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest2
|
||||
OPTIONS (import_default 'true');
|
||||
\det+ import_dest2
|
||||
\det+ import_dest2.*
|
||||
\d import_dest2.*
|
||||
CREATE SCHEMA import_dest3;
|
||||
IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest3
|
||||
OPTIONS (import_collate 'false', import_not_null 'false');
|
||||
\det+ import_dest3
|
||||
\det+ import_dest3.*
|
||||
\d import_dest3.*
|
||||
|
||||
-- Check LIMIT TO and EXCEPT
|
||||
CREATE SCHEMA import_dest4;
|
||||
IMPORT FOREIGN SCHEMA import_source LIMIT TO (t1, nonesuch)
|
||||
FROM SERVER loopback INTO import_dest4;
|
||||
\det+ import_dest4
|
||||
\det+ import_dest4.*
|
||||
IMPORT FOREIGN SCHEMA import_source EXCEPT (t1, "x 4", nonesuch)
|
||||
FROM SERVER loopback INTO import_dest4;
|
||||
\det+ import_dest4
|
||||
\det+ import_dest4.*
|
||||
|
||||
-- Assorted error cases
|
||||
IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest4;
|
||||
|
@ -4412,7 +4412,8 @@ listForeignTables(const char *pattern, bool verbose)
|
||||
"d.objoid = c.oid AND d.objsubid = 0\n");
|
||||
|
||||
processSQLNamePattern(pset.db, &buf, pattern, false, false,
|
||||
NULL, "n.nspname", "c.relname", NULL);
|
||||
"n.nspname", "c.relname", NULL,
|
||||
"pg_catalog.pg_table_is_visible(c.oid)");
|
||||
|
||||
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
|
||||
|
||||
|
Reference in New Issue
Block a user