Skip to content

Commit 91e7115

Browse files
committed
Throw a more on-point error for publications depending on columns.
Same as 42b0412, except that the trouble case is a publication WHERE clause that depends on a column. Again reported by Alexander Lakhin. Back-patch to v15 where we added publication WHERE clauses. Discussion: https://postgr.es/m/[email protected]
1 parent d45597f commit 91e7115

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/backend/commands/tablecmds.c

+16
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "catalog/pg_opclass.h"
4747
#include "catalog/pg_policy.h"
4848
#include "catalog/pg_proc.h"
49+
#include "catalog/pg_publication_rel.h"
4950
#include "catalog/pg_rewrite.h"
5051
#include "catalog/pg_statistic_ext.h"
5152
#include "catalog/pg_tablespace.h"
@@ -14227,6 +14228,21 @@ RememberAllDependentForRebuilding(AlteredTableInfo *tab, AlterTableType subtype,
1422714228
RememberStatisticsForRebuilding(foundObject.objectId, tab);
1422814229
break;
1422914230

14231+
case PublicationRelRelationId:
14232+
14233+
/*
14234+
* Column reference in a PUBLICATION ... FOR TABLE ... WHERE
14235+
* clause. Same issues as above. FIXME someday.
14236+
*/
14237+
if (subtype == AT_AlterColumnType)
14238+
ereport(ERROR,
14239+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
14240+
errmsg("cannot alter type of a column used by a publication WHERE clause"),
14241+
errdetail("%s depends on column \"%s\"",
14242+
getObjectDescription(&foundObject, false),
14243+
colName)));
14244+
break;
14245+
1423014246
default:
1423114247

1423214248
/*

0 commit comments

Comments
 (0)