Re: IF NOT EXISTS option for CREATE SERVER and CREATE USER MAPPING statements

From: Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>
To: Artur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: IF NOT EXISTS option for CREATE SERVER and CREATE USER MAPPING statements
Date: 2017-03-13 10:01:08
Message-ID: b462a9ce-cd47-42fb-5b62-75fb0c284517@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

13.03.2017 11:53, Artur Zakirov:
> On 15.02.2017 20:54, Anastasia Lubennikova wrote:
>>
>> Done.
>>
>
> I have gotten the error that AlterUserMappingStmt doesn't have
> if_not_exists (in Russian):
>
>> gram.y: В функции «base_yyparse»:
>> gram.y:4918:7: ошибка: «AlterUserMappingStmt {aka struct
>> AlterUserMappingStmt}» не содержит элемента с именем «if_not_exists»
>> n->if_not_exists = false;
>> ^~
>
> After applying the CREATE USER patch in gram.y I have:
>
>>
>> AlterUserMappingStmt: ALTER USER MAPPING FOR auth_ident SERVER name
>> alter_generic_options
>> {
>> AlterUserMappingStmt *n =
>> makeNode(AlterUserMappingStmt);
>> 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;
>> }
>> ;
>
> Here ALTER USER MAPPING and CREATE USER MAPPING commands were mixed.
>

Thanks for catching that.
It was caused by a conflict on applying of the patch.
Updated versions of both patches are attached.

--
Anastasia Lubennikova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
create_foreign_server_if_not_exists_2.0.patch text/x-patch 5.6 KB
create_user_mapping_if_not_exists_2.0.patch text/x-patch 5.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-03-13 10:24:32 Re: Partitioned tables and relfilenode
Previous Message David Rowley 2017-03-13 10:00:57 Re: multivariate statistics (v25)