Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20b6847

Browse files
committed
Fix new pg_publication_tables query.
The addition of published column names forgot to filter on attisdropped,leading to cases where you could see "........pg.dropped.1........"or the like as a reportedly-published column.While we're here, rewrite the new subquery to get a more efficient planfor it.Hou Zhijie, per report from Jaime Casanova. Back-patch to v15 wherethe bug was introduced. (Sadly, this means we need a post-beta4catversion bump before beta4 has even hit the streets. I see nogood alternative though.)Discussion:https://postgr.es/m/Yxa1SU4nH2HfN3/i@ahch-to
1 parentcec2754 commit20b6847

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

‎src/backend/catalog/system_views.sql

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,10 @@ CREATE VIEW pg_publication_tables AS
370370
N.nspnameAS schemaname,
371371
C.relnameAS tablename,
372372
(SELECT array_agg(a.attnameORDER BYa.attnum)
373-
FROM unnest(CASE WHENGPT.attrsIS NOT NULL THENGPT.attrs
374-
ELSE (SELECT array_agg(g)FROM generate_series(1,C.relnatts) g)
375-
END) k
376-
JOIN pg_attribute a
377-
ON (a.attrelid=GPT.relidANDa.attnum= k)
373+
FROM pg_attribute a
374+
WHEREa.attrelid=GPT.relidANDa.attnum>0AND
375+
NOTa.attisdroppedAND
376+
(a.attnum= ANY(GPT.attrs)ORGPT.attrs ISNULL)
378377
)AS attnames,
379378
pg_get_expr(GPT.qual,GPT.relid)AS rowfilter
380379
FROM pg_publication P,

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
*/
5858

5959
/*yyyymmddN */
60-
#defineCATALOG_VERSION_NO202209011
60+
#defineCATALOG_VERSION_NO202209062
6161

6262
#endif

‎src/test/regress/expected/rules.out

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,13 +1440,8 @@ pg_publication_tables| SELECT p.pubname,
14401440
n.nspname AS schemaname,
14411441
c.relname AS tablename,
14421442
( SELECT array_agg(a.attname ORDER BY a.attnum) AS array_agg
1443-
FROM (unnest(
1444-
CASE
1445-
WHEN (gpt.attrs IS NOT NULL) THEN (gpt.attrs)::integer[]
1446-
ELSE ( SELECT array_agg(g.g) AS array_agg
1447-
FROM generate_series(1, (c.relnatts)::integer) g(g))
1448-
END) k(k)
1449-
JOIN pg_attribute a ON (((a.attrelid = gpt.relid) AND (a.attnum = k.k))))) AS attnames,
1443+
FROM pg_attribute a
1444+
WHERE ((a.attrelid = gpt.relid) AND (a.attnum > 0) AND (NOT a.attisdropped) AND ((a.attnum = ANY ((gpt.attrs)::smallint[])) OR (gpt.attrs IS NULL)))) AS attnames,
14501445
pg_get_expr(gpt.qual, gpt.relid) AS rowfilter
14511446
FROM pg_publication p,
14521447
LATERAL pg_get_publication_tables((p.pubname)::text) gpt(relid, attrs, qual),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp