From 22bd156ff0b6727c1f5fb6069690f7e2a4cabcac Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 25 Jan 2007 11:53:52 +0000 Subject: 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. --- src/backend/utils/misc/guc.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/misc/guc.c') diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 9f2cdc43f77..dad28983336 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut . * * 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) { -- cgit v1.2.3