index 201b88d1adb1d459844625c06c6182fc27eabf54..9cede29d6a816576cea0f69de15a8ee9f92fc187 100644 (file)
@@ -3019,7 +3019,7 @@ CheckSelectLocking(Query *qry, LockClauseStrength strength)
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s is not allowed with DISTINCT clause",
LCS_asString(strength))));
- if (qry->groupClause != NIL)
+ if (qry->groupClause != NIL || qry->groupingSets != NIL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
/*------
index 37ddda7724012687d64f846bce92520655835f16..0c8c05f6c2e8e8c21d40f1d1dafdca40d8123a9f 100644 (file)
@@ -5497,7 +5497,8 @@ examine_simple_variable(PlannerInfo *root, Var *var,
* of learning something even with it.
*/
if (subquery->setOperations ||
- subquery->groupClause)
+ subquery->groupClause ||
+ subquery->groupingSets)
return;
/*
index 1e7b5a70461978bc230d2a8043920ea39d64aa5d..15862d44753e07b0d59f13a56f8e4b02ab041750 100644 (file)
@@ -50,6 +50,11 @@ select distinct on (foobar) * from pg_database;
ERROR: column "foobar" does not exist
LINE 1: select distinct on (foobar) * from pg_database;
^
+-- grouping with FOR UPDATE
+select null from pg_database group by datname for update;
+ERROR: FOR UPDATE is not allowed with GROUP BY clause
+select null from pg_database group by grouping sets (()) for update;
+ERROR: FOR UPDATE is not allowed with GROUP BY clause
--
-- DELETE
-- missing relation name (this had better not wildcard!)
index 66a56b28f62b8811dab73b5d3cb8b605b52cabb6..a7fcf72dd4509e585edef887c5ed724ee162530d 100644 (file)
@@ -37,6 +37,10 @@ select * from pg_database where pg_database.datname = nonesuch;
-- bad attribute name in select distinct on
select distinct on (foobar) * from pg_database;
+-- grouping with FOR UPDATE
+select null from pg_database group by datname for update;
+select null from pg_database group by grouping sets (()) for update;
+
--
-- DELETE