Skip to content

Commit 54ff1d3

Browse files
committed
apply 0007-Add-clause-PASSWORD-val-USING-protocol-to-CREATE-ALT.patch + cherry-pick 49eb0fd
1 parent bee9be2 commit 54ff1d3

40 files changed

+533
-352
lines changed

contrib/file_fdw/file_fdw.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ file_fdw_validator(PG_FUNCTION_ARGS)
293293
/*
294294
* Now apply the core COPY code's validation logic for more checks.
295295
*/
296-
ProcessCopyOptions(NULL, true, other_options);
296+
ProcessCopyOptions(NULL, NULL, true, other_options);
297297

298298
/*
299299
* Filename option is required for file_fdw foreign tables.
@@ -455,10 +455,10 @@ get_file_fdw_attribute_options(Oid relid)
455455
* force_null options set
456456
*/
457457
if (fnncolumns != NIL)
458-
options = lappend(options, makeDefElem("force_not_null", (Node *) fnncolumns));
458+
options = lappend(options, makeDefElem("force_not_null", (Node *) fnncolumns, -1));
459459

460460
if (fncolumns != NIL)
461-
options = lappend(options, makeDefElem("force_null", (Node *) fncolumns));
461+
options = lappend(options, makeDefElem("force_null", (Node *) fncolumns, -1));
462462

463463
return options;
464464
}
@@ -511,7 +511,7 @@ fileGetForeignPaths(PlannerInfo *root,
511511
foreigntableid,
512512
&columns))
513513
coptions = list_make1(makeDefElem("convert_selectively",
514-
(Node *) columns));
514+
(Node *) columns, -1));
515515

516516
/* Estimate costs */
517517
estimate_costs(root, baserel, fdw_private,
@@ -632,7 +632,8 @@ fileBeginForeignScan(ForeignScanState *node, int eflags)
632632
* Create CopyState from FDW options. We always acquire all columns, so
633633
* as to match the expected ScanTupleSlot signature.
634634
*/
635-
cstate = BeginCopyFrom(node->ss.ss_currentRelation,
635+
cstate = BeginCopyFrom(NULL,
636+
node->ss.ss_currentRelation,
636637
filename,
637638
false,
638639
NIL,
@@ -705,7 +706,8 @@ fileReScanForeignScan(ForeignScanState *node)
705706

706707
EndCopyFrom(festate->cstate);
707708

708-
festate->cstate = BeginCopyFrom(node->ss.ss_currentRelation,
709+
festate->cstate = BeginCopyFrom(NULL,
710+
node->ss.ss_currentRelation,
709711
festate->filename,
710712
false,
711713
NIL,
@@ -1053,7 +1055,7 @@ file_acquire_sample_rows(Relation onerel, int elevel,
10531055
/*
10541056
* Create CopyState from FDW options.
10551057
*/
1056-
cstate = BeginCopyFrom(onerel, filename, false, NIL, options);
1058+
cstate = BeginCopyFrom(NULL, onerel, filename, false, NIL, options);
10571059

10581060
/*
10591061
* Use per-tuple memory context to prevent leak of memory used to read

doc/src/sgml/ref/alter_role.sgml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ALTER ROLE <replaceable class="PARAMETER">role_specification</replaceable> [ WIT
3434
| BYPASSRLS | NOBYPASSRLS
3535
| CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
3636
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
37+
| PASSWORD '<replaceable class="PARAMETER">password</replaceable>' USING '<replaceable class="PARAMETER">protocol</replaceable>'
3738
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
3839

3940
ALTER ROLE <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
@@ -169,6 +170,7 @@ ALTER ROLE { <replaceable class="PARAMETER">role_specification</replaceable> | A
169170
<term><literal>NOBYPASSRLS</literal></term>
170171
<term><literal>CONNECTION LIMIT</literal> <replaceable class="parameter">connlimit</replaceable></term>
171172
<term><literal>PASSWORD</> <replaceable class="parameter">password</replaceable></term>
173+
<term><literal>PASSWORD</> <replaceable class="parameter">password</replaceable> USING <replaceable class="parameter">protocol</replaceable></term>
172174
<term><literal>ENCRYPTED</></term>
173175
<term><literal>UNENCRYPTED</></term>
174176
<term><literal>VALID UNTIL</literal> '<replaceable class="parameter">timestamp</replaceable>'</term>

doc/src/sgml/ref/create_role.sgml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac
3434
| BYPASSRLS | NOBYPASSRLS
3535
| CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
3636
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
37+
| PASSWORD '<replaceable class="PARAMETER">password</replaceable>' USING '<replaceable class="PARAMETER">protocol</replaceable>'
3738
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
3839
| IN ROLE <replaceable class="PARAMETER">role_name</replaceable> [, ...]
3940
| IN GROUP <replaceable class="PARAMETER">role_name</replaceable> [, ...]
@@ -244,6 +245,24 @@ CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac
244245
</listitem>
245246
</varlistentry>
246247

248+
<varlistentry>
249+
<term><literal>PASSWORD</> <replaceable class="parameter">password</replaceable> USING <replaceable class="parameter">protocol</replaceable></term>
250+
<listitem>
251+
<para>
252+
Sets the role's password using the requested protocol. (A password
253+
is only of use for roles having the <literal>LOGIN</literal>
254+
attribute, but you can nonetheless define one for roles without it.)
255+
If you do not plan to use password authentication you can omit this
256+
option. The protocols supported are <literal>md5</> to enforce
257+
a password to be MD5-encrypted, <literal>scram</> to enforce a password
258+
to be encrypted with SCRAM-SHA256, or <literal>plain</> to use
259+
an unencrypted password. If the password string is already in
260+
MD5-encrypted or SCRAM-encrypted format, then it is stored encrypted
261+
as-is.
262+
</para>
263+
</listitem>
264+
</varlistentry>
265+
247266
<varlistentry>
248267
<term><literal>VALID UNTIL</literal> '<replaceable class="parameter">timestamp</replaceable>'</term>
249268
<listitem>

src/backend/access/common/reloptions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ untransformRelOptions(Datum options)
888888
*p++ = '\0';
889889
val = (Node *) makeString(pstrdup(p));
890890
}
891-
result = lappend(result, makeDefElem(pstrdup(s), val));
891+
result = lappend(result, makeDefElem(pstrdup(s), val, -1));
892892
}
893893

894894
return result;

src/backend/catalog/aclchk.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ getRelationsInNamespace(Oid namespaceId, char relkind)
849849
* ALTER DEFAULT PRIVILEGES statement
850850
*/
851851
void
852-
ExecAlterDefaultPrivilegesStmt(AlterDefaultPrivilegesStmt *stmt)
852+
ExecAlterDefaultPrivilegesStmt(ParseState *pstate, AlterDefaultPrivilegesStmt *stmt)
853853
{
854854
GrantStmt *action = stmt->action;
855855
InternalDefaultACL iacls;
@@ -871,15 +871,17 @@ ExecAlterDefaultPrivilegesStmt(AlterDefaultPrivilegesStmt *stmt)
871871
if (dnspnames)
872872
ereport(ERROR,
873873
(errcode(ERRCODE_SYNTAX_ERROR),
874-
errmsg("conflicting or redundant options")));
874+
errmsg("conflicting or redundant options"),
875+
parser_errposition(pstate, defel->location)));
875876
dnspnames = defel;
876877
}
877878
else if (strcmp(defel->defname, "roles") == 0)
878879
{
879880
if (drolespecs)
880881
ereport(ERROR,
881882
(errcode(ERRCODE_SYNTAX_ERROR),
882-
errmsg("conflicting or redundant options")));
883+
errmsg("conflicting or redundant options"),
884+
parser_errposition(pstate, defel->location)));
883885
drolespecs = defel;
884886
}
885887
else

src/backend/commands/aggregatecmds.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
* "parameters" is a list of DefElem representing the agg's definition clauses.
5353
*/
5454
ObjectAddress
55-
DefineAggregate(List *name, List *args, bool oldstyle, List *parameters,
56-
const char *queryString)
55+
DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List *parameters)
5756
{
5857
char *aggName;
5958
Oid aggNamespace;
@@ -287,10 +286,10 @@ DefineAggregate(List *name, List *args, bool oldstyle, List *parameters,
287286
errmsg("basetype is redundant with aggregate input type specification")));
288287

289288
numArgs = list_length(args);
290-
interpret_function_parameter_list(args,
289+
interpret_function_parameter_list(pstate,
290+
args,
291291
InvalidOid,
292292
true, /* is an aggregate */
293-
queryString,
294293
&parameterTypes,
295294
&allParameterTypes,
296295
&parameterModes,

src/backend/commands/collationcmds.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* CREATE COLLATION
3939
*/
4040
ObjectAddress
41-
DefineCollation(List *names, List *parameters)
41+
DefineCollation(ParseState *pstate, List *names, List *parameters)
4242
{
4343
char *collName;
4444
Oid collNamespace;
@@ -78,7 +78,8 @@ DefineCollation(List *names, List *parameters)
7878
ereport(ERROR,
7979
(errcode(ERRCODE_SYNTAX_ERROR),
8080
errmsg("collation attribute \"%s\" not recognized",
81-
defel->defname)));
81+
defel->defname),
82+
parser_errposition(pstate, defel->location)));
8283
break;
8384
}
8485

0 commit comments

Comments
 (0)