On Tue, 18 Aug 2026 at 10:24, vignesh C <[email protected]> wrote: > > The v28 version of the attached patch handles the changes to throw an > error when a partition table is both included and excluded through an > EXCEPT clause, keeping the behavior consistent with inheritance > tables.
Few comments:
1) we are throwing this error at AlterPublicationSchemaExceptTables
which can be done from the grammar that way it need not process many
thing and then throw an error so late:
+ /*
+ * Dropping a schema from a publication removes all its EXCEPT
entries via
+ * cascade. The concept of "drop all schema tables from the publication
+ * EXCEPT these ones" is not supported.
+ */
+ if (stmt->action == AP_DropObjects)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("EXCEPT clause is not
supported with DROP in ALTER PUBLICATION")));
Attached a patch to handle this from gram.y file.
2) WITH options tab completion missing for:
create publication pub1 for tables in schema sch1 except ( table sch1.t1 )
3) CheckExceptConflicts prototype appears twice:
static void CheckSchemaListNotExcluded(Oid pubid, List *schemaidlist);
+static void CheckExceptConflicts(Oid pubid, List *except_rels,
+ List
*cross_schema_children,
+ List
*explicitrelids, List *pubschemas,
+ bool
existing_except_kept);
static void PublicationAddExceptTables(Oid pubid, List *except_pubtables,
and
-
List *except_rels);
+
List *except_rels,
+
bool existing_except_kept);
+static void CheckExceptConflicts(Oid pubid, List *except_rels,
+ List
*cross_schema_children,
+ List
*explicitrelids, List *pubschemas,
+ bool
existing_except_kept);
4) We have the following check in 0002 patch:
/*
* XXX EXCEPT with SET is not currently implemented. Workaround: DROP and
* re-ADD the schema with the desired EXCEPT list.
*/
if (stmt->action == AP_SetObjects)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("EXCEPT clause is not supported with SET in
ALTER PUBLICATION"),
errhint("Drop and re-add the schema with the desired
EXCEPT list.")));
Let's move this check to 0001 patch
5) Similarly we should add a similar check for ALTER PUBLICATION ...
ADD TABLES IN SCHEMA EXCEPT to throw an error from the first patch.
6) code compiles without this include, we can remove this:
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 17035fb4d15..14520a5ccab 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -58,6 +58,7 @@
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "parser/parser.h"
+#include "utils/builtins.h"
#include "utils/datetime.h"
#include "utils/xml.h"
7) Here the publicationcmds.h should be included before repack.h to
maintain the ordering:
#include "commands/extension.h"
#include "commands/repack.h"
+#include "commands/publicationcmds.h"
#include "commands/sequence.h"
8) We can keep the same parameter ordering in both
AlterPublicationSchemas and AlterPublicationSchemaExceptTables
functions, except_pubtables and schemaidlist are placed differently in
both:
+static void AlterPublicationSchemas(AlterPublicationStmt *stmt,
+
HeapTuple tup, List *schemaidlist,
+
List *except_pubtables);
+static void AlterPublicationSchemaExceptTables(AlterPublicationStmt *stmt,
+
HeapTuple tup,
+
List *except_pubtables,
+
List *schemaidlist);
Regards,
Vignesh
Drop_Tables_throw_error_from_parser.patch
Description: Binary data
