mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
Simplify optional WITH handling in CREATE USER, ALTER USER, CREATE
GROUP. Make WITH optional in CREATE DATABASE for consistency.
This commit is contained in:
parent
0daee96ed1
commit
f91ee129a7
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_database.sgml,v 1.27 2002/04/21 19:02:39 thomas Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_database.sgml,v 1.28 2002/06/17 05:40:32 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -22,7 +22,7 @@ PostgreSQL documentation
|
||||
</refsynopsisdivinfo>
|
||||
<synopsis>
|
||||
CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
|
||||
[ WITH [ OWNER [=] <replaceable class="parameter">dbowner</replaceable> ]
|
||||
[ [ WITH ] [ OWNER [=] <replaceable class="parameter">dbowner</replaceable> ]
|
||||
[ LOCATION [=] '<replaceable class="parameter">dbpath</replaceable>' ]
|
||||
[ TEMPLATE [=] <replaceable class="parameter">template</replaceable> ]
|
||||
[ ENCODING [=] <replaceable class="parameter">encoding</replaceable> ] ]
|
||||
|
@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.323 2002/06/15 03:00:03 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.324 2002/06/17 05:40:32 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@ -201,7 +201,7 @@ static void doNegateFloat(Value *v);
|
||||
|
||||
%type <list> stmtblock, stmtmulti,
|
||||
OptTableElementList, OptInherit, definition, opt_distinct,
|
||||
opt_with, func_args, func_args_list, func_as, createfunc_opt_list
|
||||
opt_definition, func_args, func_args_list, func_as, createfunc_opt_list
|
||||
oper_argtypes, RuleActionList, RuleActionMulti,
|
||||
opt_column_list, columnList, opt_name_list,
|
||||
sort_clause, sortby_list, index_params, index_list, name_list,
|
||||
@ -232,7 +232,7 @@ static void doNegateFloat(Value *v);
|
||||
%type <ival> opt_interval
|
||||
%type <node> overlay_placing, substr_from, substr_for
|
||||
|
||||
%type <boolean> opt_binary, opt_using, opt_instead, opt_cursor
|
||||
%type <boolean> opt_binary, opt_using, opt_instead, opt_cursor, opt_with
|
||||
%type <boolean> opt_with_copy, index_opt_unique, opt_verbose, opt_full
|
||||
%type <boolean> opt_freeze, analyze_keyword
|
||||
|
||||
@ -518,14 +518,7 @@ stmt : AlterDatabaseSetStmt
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
CreateUserStmt: CREATE USER UserId OptUserList
|
||||
{
|
||||
CreateUserStmt *n = makeNode(CreateUserStmt);
|
||||
n->user = $3;
|
||||
n->options = $4;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| CREATE USER UserId WITH OptUserList
|
||||
CreateUserStmt: CREATE USER UserId opt_with OptUserList
|
||||
{
|
||||
CreateUserStmt *n = makeNode(CreateUserStmt);
|
||||
n->user = $3;
|
||||
@ -534,6 +527,11 @@ CreateUserStmt: CREATE USER UserId OptUserList
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
opt_with: WITH { $$ = TRUE; }
|
||||
| /*EMPTY*/ { $$ = TRUE; }
|
||||
;
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Alter a postgresql DBMS user
|
||||
@ -541,14 +539,7 @@ CreateUserStmt: CREATE USER UserId OptUserList
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
AlterUserStmt: ALTER USER UserId OptUserList
|
||||
{
|
||||
AlterUserStmt *n = makeNode(AlterUserStmt);
|
||||
n->user = $3;
|
||||
n->options = $4;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ALTER USER UserId WITH OptUserList
|
||||
AlterUserStmt: ALTER USER UserId opt_with OptUserList
|
||||
{
|
||||
AlterUserStmt *n = makeNode(AlterUserStmt);
|
||||
n->user = $3;
|
||||
@ -680,14 +671,7 @@ user_list: user_list ',' UserId
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
CreateGroupStmt: CREATE GROUP_P UserId OptGroupList
|
||||
{
|
||||
CreateGroupStmt *n = makeNode(CreateGroupStmt);
|
||||
n->name = $3;
|
||||
n->options = $4;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| CREATE GROUP_P UserId WITH OptGroupList
|
||||
CreateGroupStmt: CREATE GROUP_P UserId opt_with OptGroupList
|
||||
{
|
||||
CreateGroupStmt *n = makeNode(CreateGroupStmt);
|
||||
n->name = $3;
|
||||
@ -2775,7 +2759,7 @@ RecipeStmt: EXECUTE RECIPE recipe_name
|
||||
*****************************************************************************/
|
||||
|
||||
CreateFunctionStmt: CREATE opt_or_replace FUNCTION func_name func_args
|
||||
RETURNS func_return createfunc_opt_list opt_with
|
||||
RETURNS func_return createfunc_opt_list opt_definition
|
||||
{
|
||||
CreateFunctionStmt *n = makeNode(CreateFunctionStmt);
|
||||
n->replace = $2;
|
||||
@ -2951,7 +2935,7 @@ func_as: Sconst
|
||||
{ $$ = makeList2(makeString($1), makeString($3)); }
|
||||
;
|
||||
|
||||
opt_with: WITH definition { $$ = $2; }
|
||||
opt_definition: WITH definition { $$ = $2; }
|
||||
| /*EMPTY*/ { $$ = NIL; }
|
||||
;
|
||||
|
||||
@ -3324,7 +3308,7 @@ LoadStmt: LOAD file_name
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
CreatedbStmt: CREATE DATABASE database_name WITH createdb_opt_list
|
||||
CreatedbStmt: CREATE DATABASE database_name opt_with createdb_opt_list
|
||||
{
|
||||
CreatedbStmt *n = makeNode(CreatedbStmt);
|
||||
List *l;
|
||||
@ -3437,7 +3421,8 @@ createdb_opt_item: LOCATION opt_equal Sconst
|
||||
|
||||
/*
|
||||
* Though the equals sign doesn't match other WITH options, pg_dump uses
|
||||
* equals for backward compability, and it doesn't seem worth remove it.
|
||||
* equals for backward compability, and it doesn't seem worth removing it.
|
||||
* 2002-02-25
|
||||
*/
|
||||
opt_equal: '=' { $$ = TRUE; }
|
||||
| /*EMPTY*/ { $$ = FALSE; }
|
||||
|
Loading…
Reference in New Issue
Block a user