1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Various fixes in the logic of XML functions:

- Add new SQL command SET XML OPTION (also available via regular GUC) to
  control the DOCUMENT vs. CONTENT option in implicit parsing and
  serialization operations.

- Subtle corrections in the handling of the standalone property in
  xmlroot().

- Allow xmlroot() to work on content fragments.

- Subtle corrections in the handling of the version property in
  xmlconcat().

- Code refactoring for producing XML declarations.
This commit is contained in:
Peter Eisentraut
2007-01-25 11:53:52 +00:00
parent 9597446d11
commit 22bd156ff0
13 changed files with 329 additions and 121 deletions

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.370 2007/01/25 04:35:11 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.371 2007/01/25 11:53:51 petere Exp $
*
*--------------------------------------------------------------------
*/
@ -145,6 +145,7 @@ static const char *assign_canonical_path(const char *newval, bool doit, GucSourc
static const char *assign_backslash_quote(const char *newval, bool doit, GucSource source);
static const char *assign_timezone_abbreviations(const char *newval, bool doit, GucSource source);
static const char *assign_xmlbinary(const char *newval, bool doit, GucSource source);
static const char *assign_xmloption(const char *newval, bool doit, GucSource source);
static bool assign_tcp_keepalives_idle(int newval, bool doit, GucSource source);
static bool assign_tcp_keepalives_interval(int newval, bool doit, GucSource source);
@ -233,6 +234,7 @@ static char *XactIsoLevel_string;
static char *data_directory;
static char *custom_variable_classes;
static char *xmlbinary_string;
static char *xmloption_string;
static int max_function_args;
static int max_index_keys;
static int max_identifier_length;
@ -2292,6 +2294,16 @@ static struct config_string ConfigureNamesString[] =
"base64", assign_xmlbinary, NULL
},
{
{"xmloption", PGC_USERSET, CLIENT_CONN_STATEMENT,
gettext_noop("Sets whether XML data in implicit parsing and serialization "
"operations is to be considered as documents or content fragments."),
gettext_noop("Valid values are DOCUMENT and CONTENT.")
},
&xmloption_string,
"content", assign_xmloption, NULL
},
{
{"temp_tablespaces", PGC_USERSET, PGC_S_FILE,
gettext_noop("Sets the tablespaces suitable for creating new objects and sort files."),
@ -6516,6 +6528,24 @@ assign_xmlbinary(const char *newval, bool doit, GucSource source)
return newval;
}
static const char *
assign_xmloption(const char *newval, bool doit, GucSource source)
{
XmlOptionType xo;
if (pg_strcasecmp(newval, "document") == 0)
xo = XMLOPTION_DOCUMENT;
else if (pg_strcasecmp(newval, "content") == 0)
xo = XMLOPTION_CONTENT;
else
return NULL; /* reject */
if (doit)
xmloption = xo;
return newval;
}
static bool
assign_tcp_keepalives_idle(int newval, bool doit, GucSource source)
{