Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab0a37f

Browse files
committed
Make the enumvals column of pg_settings be text[] instead of just
a comma separated string.
1 parent47d6d64 commitab0a37f

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

‎src/backend/utils/misc/guc.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.479 2008/11/19 02:07:07 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.480 2008/11/21 18:49:24 mha Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -168,11 +168,14 @@ static bool assign_maxconnections(int newval, bool doit, GucSource source);
168168
staticconstchar*assign_pgstat_temp_directory(constchar*newval,booldoit,GucSourcesource);
169169

170170
staticchar*config_enum_get_options(structconfig_enum*record,
171-
constchar*prefix,constchar*suffix);
171+
constchar*prefix,constchar*suffix,
172+
constchar*separator);
172173

173174

174175
/*
175176
* Options for enum values defined in this module.
177+
*
178+
* NOTE! Option values may not contain double quotes!
176179
*/
177180

178181
/*
@@ -4427,7 +4430,8 @@ config_enum_lookup_by_name(struct config_enum *record, const char *value, int *r
44274430
* If suffix is non-NULL, it is added to the end of the string.
44284431
*/
44294432
staticchar*
4430-
config_enum_get_options(structconfig_enum*record,constchar*prefix,constchar*suffix)
4433+
config_enum_get_options(structconfig_enum*record,constchar*prefix,
4434+
constchar*suffix,constchar*separator)
44314435
{
44324436
conststructconfig_enum_entry*entry=record->options;
44334437
intlen=0;
@@ -4439,7 +4443,7 @@ config_enum_get_options(struct config_enum *record, const char *prefix, const ch
44394443
while (entry&&entry->name)
44404444
{
44414445
if (!entry->hidden)
4442-
len+=strlen(entry->name)+2;/* string and ", " */
4446+
len+=strlen(entry->name)+strlen(separator);
44434447

44444448
entry++;
44454449
}
@@ -4454,7 +4458,7 @@ config_enum_get_options(struct config_enum *record, const char *prefix, const ch
44544458
if (!entry->hidden)
44554459
{
44564460
strcat(hintmsg,entry->name);
4457-
strcat(hintmsg,", ");
4461+
strcat(hintmsg,separator);
44584462
}
44594463

44604464
entry++;
@@ -4469,16 +4473,15 @@ config_enum_get_options(struct config_enum *record, const char *prefix, const ch
44694473
* to make sure we don't write to invalid memory instead of actually
44704474
* trying to do something smart with it.
44714475
*/
4472-
if (len>1)
4473-
/* Replace finalcomma/space */
4474-
hintmsg[len-2]='\0';
4476+
if (len >=strlen(separator))
4477+
/* Replace finalseparator */
4478+
hintmsg[len-strlen(separator)]='\0';
44754479

44764480
strcat(hintmsg,suffix);
44774481

44784482
returnhintmsg;
44794483
}
44804484

4481-
44824485
/*
44834486
* Call a GucStringAssignHook function, being careful to free the
44844487
* "newval" string if the hook ereports.
@@ -5044,7 +5047,7 @@ set_config_option(const char *name, const char *value,
50445047
{
50455048
if (!config_enum_lookup_by_name(conf,value,&newval))
50465049
{
5047-
char*hintmsg=config_enum_get_options(conf,"Available values: ",".");
5050+
char*hintmsg=config_enum_get_options(conf,"Available values: ",".",", ");
50485051

50495052
ereport(elevel,
50505053
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -6249,7 +6252,8 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
62496252
values[10]=NULL;
62506253

62516254
/* enumvals */
6252-
values[11]=config_enum_get_options((structconfig_enum*)conf,"","");
6255+
/* NOTE! enumvals with double quotes in them are not supported! */
6256+
values[11]=config_enum_get_options((structconfig_enum*)conf,"{\"","\"}","\",\"");
62536257

62546258
/* boot_val */
62556259
values[12]=pstrdup(config_enum_lookup_by_value(lconf,lconf->boot_val));
@@ -6385,7 +6389,7 @@ show_all_settings(PG_FUNCTION_ARGS)
63856389
TupleDescInitEntry(tupdesc, (AttrNumber)11,"max_val",
63866390
TEXTOID,-1,0);
63876391
TupleDescInitEntry(tupdesc, (AttrNumber)12,"enumvals",
6388-
TEXTOID,-1,0);
6392+
TEXTARRAYOID,-1,0);
63896393
TupleDescInitEntry(tupdesc, (AttrNumber)13,"boot_val",
63906394
TEXTOID,-1,0);
63916395
TupleDescInitEntry(tupdesc, (AttrNumber)14,"reset_val",

‎src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.508 2008/11/15 19:43:46 tgl Exp $
40+
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.509 2008/11/21 18:49:24 mha Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO200811151
56+
#defineCATALOG_VERSION_NO200811211
5757

5858
#endif

‎src/include/catalog/pg_proc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.528 2008/11/14 00:51:46 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.529 2008/11/21 18:49:24 mha Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -3166,7 +3166,7 @@ DATA(insert OID = 2077 ( current_settingPGNSP PGUID 12 1 0 0 f f t f s 1 25 "2
31663166
DESCR("SHOW X as a function");
31673167
DATA(insertOID=2078 (set_configPGNSPPGUID12100ffffv325"25 25 16"_null__null__null_set_config_by_name_null__null__null_ ));
31683168
DESCR("SET X as a function");
3169-
DATA(insertOID=2084 (pg_show_all_settingsPGNSPPGUID12110000fftts02249"""{25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,23}""{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}""{name,setting,unit,category,short_desc,extra_desc,context,vartype,source,min_val,max_val,enumvals,boot_val,reset_val,sourcefile,sourceline}"show_all_settings_null__null__null_ ));
3169+
DATA(insertOID=2084 (pg_show_all_settingsPGNSPPGUID12110000fftts02249"""{25,25,25,25,25,25,25,25,25,25,25,1009,25,25,25,23}""{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}""{name,setting,unit,category,short_desc,extra_desc,context,vartype,source,min_val,max_val,enumvals,boot_val,reset_val,sourcefile,sourceline}"show_all_settings_null__null__null_ ));
31703170
DESCR("SHOW ALL as a function");
31713171
DATA(insertOID=1371 (pg_lock_statusPGNSPPGUID12110000ffttv02249"""{25,26,26,23,21,25,28,26,26,21,25,23,25,16}""{o,o,o,o,o,o,o,o,o,o,o,o,o,o}""{locktype,database,relation,page,tuple,virtualxid,transactionid,classid,objid,objsubid,virtualtransaction,pid,mode,granted}"pg_lock_status_null__null__null_ ));
31723172
DESCR("view system lock information");

‎src/include/catalog/pg_type.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.202 2008/11/14 02:09:52 tgl Exp $
11+
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.203 2008/11/21 18:49:24 mha Exp $
1212
*
1313
* NOTES
1414
* the genbki.sh script reads this file and generates .bki
@@ -435,6 +435,7 @@ DATA(insert OID = 1007 ( _int4 PGNSP PGUID -1 f b A f t \054 023 0 array_in
435435
#defineINT4ARRAYOID1007
436436
DATA(insertOID=1008 (_regprocPGNSPPGUID-1fbAft \0540240array_inarray_outarray_recvarray_send---ixf0-10_null__null_ ));
437437
DATA(insertOID=1009 (_textPGNSPPGUID-1fbAft \0540250array_inarray_outarray_recvarray_send---ixf0-10_null__null_ ));
438+
#defineTEXTARRAYOID1009
438439
DATA(insertOID=1028 (_oidPGNSPPGUID-1fbAft \0540260array_inarray_outarray_recvarray_send---ixf0-10_null__null_ ));
439440
DATA(insertOID=1010 (_tidPGNSPPGUID-1fbAft \0540270array_inarray_outarray_recvarray_send---ixf0-10_null__null_ ));
440441
DATA(insertOID=1011 (_xidPGNSPPGUID-1fbAft \0540280array_inarray_outarray_recvarray_send---ixf0-10_null__null_ ));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp