Hi everyone,

Just trying the new column/row filter on v15, I found this issue that
could be replicated very easily.

"""
postgres=# create table t1(i serial primary key);
CREATE TABLE
postgres=# alter table t1 drop i;
ALTER TABLE
postgres=# alter table t1 add id serial primary key;
ALTER TABLE
postgres=# create publication pub_t1 for table t1;
CREATE PUBLICATION

postgres=# select * from pg_publication_tables where pubname = 'pub_t1' \gx
-[ RECORD 1 ]---------------------------------
pubname    | pub_t1
schemaname | public
tablename  | t1
attnames   | {........pg.dropped.1........,id}
rowfilter  |
"""

This could be solved by adding a "NOT attisdropped", simple patch
attached.

-- 
Jaime Casanova
Director de Servicios Profesionales
SystemGuards - Consultores de PostgreSQL
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index fedaed533b..431864648c 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -369,7 +369,7 @@ CREATE VIEW pg_publication_tables AS
         P.pubname AS pubname,
         N.nspname AS schemaname,
         C.relname AS tablename,
-        ( SELECT array_agg(a.attname ORDER BY a.attnum)
+        ( SELECT array_agg(a.attname ORDER BY a.attnum) FILTER (WHERE NOT a.attisdropped)
           FROM unnest(CASE WHEN GPT.attrs IS NOT NULL THEN GPT.attrs
                       ELSE (SELECT array_agg(g) FROM generate_series(1, C.relnatts) g)
                       END) k

Reply via email to