diff options
| author | Andrew Gierth | 2019-03-19 01:16:50 +0000 |
|---|---|---|
| committer | Andrew Gierth | 2019-03-19 01:16:50 +0000 |
| commit | 01bde4fa4c24f4eea0a634d8fcad0b376efda6b1 (patch) | |
| tree | 3891ad9efa650892c78e8d13f41c5eb151ff7a9e /src/backend/parser | |
| parent | f2004f19ed9c9228d3ea2b12379ccb4b9212641f (diff) | |
Implement OR REPLACE option for CREATE AGGREGATE.
Aggregates have acquired a dozen or so optional attributes in recent
years for things like parallel query and moving-aggregate mode; the
lack of an OR REPLACE option to add or change these for an existing
agg makes extension upgrades gratuitously hard. Rectify.
Diffstat (limited to 'src/backend/parser')
| -rw-r--r-- | src/backend/parser/gram.y | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index e814939a254..502e51bb0e1 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -5618,25 +5618,27 @@ CreateAssertionStmt: *****************************************************************************/ DefineStmt: - CREATE AGGREGATE func_name aggr_args definition + CREATE opt_or_replace AGGREGATE func_name aggr_args definition { DefineStmt *n = makeNode(DefineStmt); n->kind = OBJECT_AGGREGATE; n->oldstyle = false; - n->defnames = $3; - n->args = $4; - n->definition = $5; + n->replace = $2; + n->defnames = $4; + n->args = $5; + n->definition = $6; $$ = (Node *)n; } - | CREATE AGGREGATE func_name old_aggr_definition + | CREATE opt_or_replace AGGREGATE func_name old_aggr_definition { /* old-style (pre-8.2) syntax for CREATE AGGREGATE */ DefineStmt *n = makeNode(DefineStmt); n->kind = OBJECT_AGGREGATE; n->oldstyle = true; - n->defnames = $3; + n->replace = $2; + n->defnames = $4; n->args = NIL; - n->definition = $4; + n->definition = $5; $$ = (Node *)n; } | CREATE OPERATOR any_operator definition |
