@@ -175,8 +175,7 @@ parse_publication_options(ParseState *pstate,
175
175
static void
176
176
ObjectsInPublicationToOids (List * pubobjspec_list , ParseState * pstate ,
177
177
List * * tables , List * * sequences ,
178
- List * * tables_schemas , List * * sequences_schemas ,
179
- List * * schemas )
178
+ List * * tables_schemas , List * * sequences_schemas )
180
179
{
181
180
ListCell * cell ;
182
181
PublicationObjSpec * pubobj ;
@@ -204,14 +203,12 @@ ObjectsInPublicationToOids(List *pubobjspec_list, ParseState *pstate,
204
203
205
204
/* Filter out duplicates if user specifies "sch1, sch1" */
206
205
* tables_schemas = list_append_unique_oid (* tables_schemas , schemaid );
207
- * schemas = list_append_unique_oid (* schemas , schemaid );
208
206
break ;
209
207
case PUBLICATIONOBJ_SEQUENCES_IN_SCHEMA :
210
208
schemaid = get_namespace_oid (pubobj -> name , false);
211
209
212
210
/* Filter out duplicates if user specifies "sch1, sch1" */
213
211
* sequences_schemas = list_append_unique_oid (* sequences_schemas , schemaid );
214
- * schemas = list_append_unique_oid (* schemas , schemaid );
215
212
break ;
216
213
case PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA :
217
214
search_path = fetch_search_path (false);
@@ -225,7 +222,6 @@ ObjectsInPublicationToOids(List *pubobjspec_list, ParseState *pstate,
225
222
226
223
/* Filter out duplicates if user specifies "sch1, sch1" */
227
224
* tables_schemas = list_append_unique_oid (* tables_schemas , schemaid );
228
- * schemas = list_append_unique_oid (* schemas , schemaid );
229
225
break ;
230
226
case PUBLICATIONOBJ_SEQUENCES_IN_CUR_SCHEMA :
231
227
search_path = fetch_search_path (false);
@@ -239,7 +235,6 @@ ObjectsInPublicationToOids(List *pubobjspec_list, ParseState *pstate,
239
235
240
236
/* Filter out duplicates if user specifies "sch1, sch1" */
241
237
* sequences_schemas = list_append_unique_oid (* sequences_schemas , schemaid );
242
- * schemas = list_append_unique_oid (* schemas , schemaid );
243
238
break ;
244
239
default :
245
240
/* shouldn't happen */
@@ -679,7 +674,6 @@ CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt)
679
674
List * sequences = NIL ;
680
675
List * tables_schemaidlist = NIL ;
681
676
List * sequences_schemaidlist = NIL ;
682
- List * schemaidlist = NIL ;
683
677
684
678
bool for_all_tables = false;
685
679
bool for_all_sequences = false;
@@ -706,6 +700,12 @@ CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt)
706
700
(errcode (ERRCODE_INSUFFICIENT_PRIVILEGE ),
707
701
errmsg ("must be superuser to create FOR ALL TABLES publication" )));
708
702
703
+ /* FOR ALL SEQUENCES requires superuser */
704
+ if (for_all_sequences && !superuser ())
705
+ ereport (ERROR ,
706
+ (errcode (ERRCODE_INSUFFICIENT_PRIVILEGE ),
707
+ errmsg ("must be superuser to create FOR ALL SEQUENCES publication" )));
708
+
709
709
rel = table_open (PublicationRelationId , RowExclusiveLock );
710
710
711
711
/* Check if name is used */
@@ -782,8 +782,7 @@ CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt)
782
782
ObjectsInPublicationToOids (stmt -> pubobjects , pstate ,
783
783
& tables , & sequences ,
784
784
& tables_schemaidlist ,
785
- & sequences_schemaidlist ,
786
- & schemaidlist );
785
+ & sequences_schemaidlist );
787
786
788
787
/* FOR ALL TABLES IN SCHEMA requires superuser */
789
788
if (list_length (tables_schemaidlist ) > 0 && !superuser ())
@@ -1321,7 +1320,7 @@ CheckAlterPublication(AlterPublicationStmt *stmt, HeapTuple tup,
1321
1320
NameStr (pubform -> pubname )),
1322
1321
errdetail ("Tables cannot be added to or dropped from FOR ALL TABLES publications." )));
1323
1322
1324
- /* Check that user is allowed to manipulate the publication tables . */
1323
+ /* Check that user is allowed to manipulate the publication sequences . */
1325
1324
if (sequences && pubform -> puballsequences )
1326
1325
ereport (ERROR ,
1327
1326
(errcode (ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE ),
@@ -1462,14 +1461,12 @@ AlterPublication(ParseState *pstate, AlterPublicationStmt *stmt)
1462
1461
List * sequences = NIL ;
1463
1462
List * tables_schemaidlist = NIL ;
1464
1463
List * sequences_schemaidlist = NIL ;
1465
- List * schemaidlist = NIL ;
1466
1464
Oid pubid = pubform -> oid ;
1467
1465
1468
1466
ObjectsInPublicationToOids (stmt -> pubobjects , pstate ,
1469
1467
& tables , & sequences ,
1470
1468
& tables_schemaidlist ,
1471
- & sequences_schemaidlist ,
1472
- & schemaidlist );
1469
+ & sequences_schemaidlist );
1473
1470
1474
1471
CheckAlterPublication (stmt , tup ,
1475
1472
tables , tables_schemaidlist ,
0 commit comments