mirror of
https://github.com/postgres/postgres.git
synced 2025-10-29 22:49:41 +03:00
Add IF NOT EXISTS for CREATE SERVER and CREATE USER MAPPING
There is still some inconsistency with the error messages surrounding foreign servers. Some use the word "foreign" and some don't. My inclination is to remove all such uses of "foreign" on the basis that the CREATE/ALTER/DROP SERVER commands don't use the word. However, that is left for another day. In this patch I have kept to the existing usage in the affected commands, which omits "foreign". Anastasia Lubennikova, reviewed by Arthur Zakirov and Ashtosh Bapat. Discussion: http://postgr.es/m/7c2ab9b8-388a-1ce0-23a3-7acf2a0ed3c6@postgrespro.ru
This commit is contained in:
@@ -4621,6 +4621,19 @@ CreateForeignServerStmt: CREATE SERVER name opt_type opt_foreign_server_version
|
||||
n->version = $5;
|
||||
n->fdwname = $9;
|
||||
n->options = $10;
|
||||
n->if_not_exists = false;
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
| CREATE SERVER IF_P NOT EXISTS name opt_type opt_foreign_server_version
|
||||
FOREIGN DATA_P WRAPPER name create_generic_options
|
||||
{
|
||||
CreateForeignServerStmt *n = makeNode(CreateForeignServerStmt);
|
||||
n->servername = $6;
|
||||
n->servertype = $7;
|
||||
n->version = $8;
|
||||
n->fdwname = $12;
|
||||
n->options = $13;
|
||||
n->if_not_exists = true;
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
;
|
||||
@@ -4853,6 +4866,16 @@ CreateUserMappingStmt: CREATE USER MAPPING FOR auth_ident SERVER name create_gen
|
||||
n->user = $5;
|
||||
n->servername = $7;
|
||||
n->options = $8;
|
||||
n->if_not_exists = false;
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
| CREATE USER MAPPING IF_P NOT EXISTS FOR auth_ident SERVER name create_generic_options
|
||||
{
|
||||
CreateUserMappingStmt *n = makeNode(CreateUserMappingStmt);
|
||||
n->user = $8;
|
||||
n->servername = $10;
|
||||
n->options = $11;
|
||||
n->if_not_exists = true;
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user