a comma separated string.
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.479 2008/11/19 02:07:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.480 2008/11/21 18:49:24 mha Exp $
*
*--------------------------------------------------------------------
*/
static const char *assign_pgstat_temp_directory(const char *newval, bool doit, GucSource source);
static char *config_enum_get_options(struct config_enum *record,
- const char *prefix, const char *suffix);
+ const char *prefix, const char *suffix,
+ const char *separator);
/*
* Options for enum values defined in this module.
+ *
+ * NOTE! Option values may not contain double quotes!
*/
/*
* If suffix is non-NULL, it is added to the end of the string.
*/
static char *
-config_enum_get_options(struct config_enum *record, const char *prefix, const char *suffix)
+config_enum_get_options(struct config_enum *record, const char *prefix,
+ const char *suffix, const char *separator)
{
const struct config_enum_entry *entry = record->options;
int len = 0;
while (entry && entry->name)
{
if (!entry->hidden)
- len += strlen(entry->name) + 2; /* string and ", " */
+ len += strlen(entry->name) + strlen(separator);
entry++;
}
if (!entry->hidden)
{
strcat(hintmsg, entry->name);
- strcat(hintmsg, ", ");
+ strcat(hintmsg, separator);
}
entry++;
* to make sure we don't write to invalid memory instead of actually
* trying to do something smart with it.
*/
- if (len > 1)
- /* Replace final comma/space */
- hintmsg[len-2] = '\0';
+ if (len >= strlen(separator))
+ /* Replace final separator */
+ hintmsg[len-strlen(separator)] = '\0';
strcat(hintmsg, suffix);
return hintmsg;
}
-
/*
* Call a GucStringAssignHook function, being careful to free the
* "newval" string if the hook ereports.
{
if (!config_enum_lookup_by_name(conf, value, &newval))
{
- char *hintmsg = config_enum_get_options(conf, "Available values: ", ".");
+ char *hintmsg = config_enum_get_options(conf, "Available values: ", ".", ", ");
ereport(elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
values[10] = NULL;
/* enumvals */
- values[11] = config_enum_get_options((struct config_enum *) conf, "", "");
+ /* NOTE! enumvals with double quotes in them are not supported! */
+ values[11] = config_enum_get_options((struct config_enum *) conf, "{\"", "\"}", "\",\"");
/* boot_val */
values[12] = pstrdup(config_enum_lookup_by_value(lconf, lconf->boot_val));
TupleDescInitEntry(tupdesc, (AttrNumber) 11, "max_val",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 12, "enumvals",
- TEXTOID, -1, 0);
+ TEXTARRAYOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 13, "boot_val",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 14, "reset_val",
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.508 2008/11/15 19:43:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.509 2008/11/21 18:49:24 mha Exp $
*
*-------------------------------------------------------------------------
*/
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200811151
+#define CATALOG_VERSION_NO 200811211
#endif
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.528 2008/11/14 00:51:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.529 2008/11/21 18:49:24 mha Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
DESCR("SHOW X as a function");
DATA(insert OID = 2078 ( set_config PGNSP PGUID 12 1 0 0 f f f f v 3 25 "25 25 16" _null_ _null_ _null_ set_config_by_name _null_ _null_ _null_ ));
DESCR("SET X as a function");
-DATA(insert OID = 2084 ( pg_show_all_settings PGNSP PGUID 12 1 1000 0 f f t t s 0 2249 "" "{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_ ));
+DATA(insert OID = 2084 ( pg_show_all_settings PGNSP PGUID 12 1 1000 0 f f t t s 0 2249 "" "{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_ ));
DESCR("SHOW ALL as a function");
DATA(insert OID = 1371 ( pg_lock_status PGNSP PGUID 12 1 1000 0 f f t t v 0 2249 "" "{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_ ));
DESCR("view system lock information");
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.202 2008/11/14 02:09:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.203 2008/11/21 18:49:24 mha Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
#define INT4ARRAYOID 1007
DATA(insert OID = 1008 ( _regproc PGNSP PGUID -1 f b A f t \054 0 24 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
DATA(insert OID = 1009 ( _text PGNSP PGUID -1 f b A f t \054 0 25 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
+#define TEXTARRAYOID 1009
DATA(insert OID = 1028 ( _oid PGNSP PGUID -1 f b A f t \054 0 26 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
DATA(insert OID = 1010 ( _tid PGNSP PGUID -1 f b A f t \054 0 27 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
DATA(insert OID = 1011 ( _xid PGNSP PGUID -1 f b A f t \054 0 28 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));