Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2054071

Browse files
committed
Delete contrib/xml2's legacy implementation of xml_is_well_formed().
This function is unreferenced in modern usage; it was superseded in 9.1 by a core function of the same name. It has been left in place in the C code only so that pre-9.1 SQL definitions of the contrib/xml2 functions would continue to work. Six years seems like enough time for people to have updated to the extension-style version of the xml2 module, so let's drop this. The key reason for not keeping it any longer is that we want to stick an explicit PGDLLEXPORT into PG_FUNCTION_INFO_V1(), and the similarity of name to the core function creates a conflict that compilers will complain about. Extracted from a larger patch for that purpose. I'm committing this change separately to give it more visibility in the commit logs. While at it, remove the documentation entry that claimed that xml_is_well_formed() is a function provided by contrib/xml2, and instead mention the even more ancient alias xml_valid(). Laurenz Albe, doc change by me Patch: <A737B7A37273E048B164557ADEF4A58B53962ED8@ntex2010a.host.magwien.gv.at>
1 parent d5f6f13 commit 2054071

File tree

2 files changed

+5
-50
lines changed

2 files changed

+5
-50
lines changed

contrib/xml2/xpath.c

-45
Original file line numberDiff line numberDiff line change
@@ -81,51 +81,6 @@ pgxml_parser_init(PgXmlStrictness strictness)
8181
}
8282

8383

84-
/*
85-
* Returns true if document is well-formed
86-
*
87-
* Note: this has been superseded by a core function. We still have to
88-
* have it in the contrib module so that existing SQL-level references
89-
* to the function won't fail; but in normal usage with up-to-date SQL
90-
* definitions for the contrib module, this won't be called.
91-
*/
92-
93-
PG_FUNCTION_INFO_V1(xml_is_well_formed);
94-
95-
Datum
96-
xml_is_well_formed(PG_FUNCTION_ARGS)
97-
{
98-
text *t = PG_GETARG_TEXT_P(0); /* document buffer */
99-
bool result = false;
100-
int32 docsize = VARSIZE(t) - VARHDRSZ;
101-
xmlDocPtr doctree;
102-
PgXmlErrorContext *xmlerrcxt;
103-
104-
xmlerrcxt = pgxml_parser_init(PG_XML_STRICTNESS_LEGACY);
105-
106-
PG_TRY();
107-
{
108-
doctree = xmlParseMemory((char *) VARDATA(t), docsize);
109-
110-
result = (doctree != NULL);
111-
112-
if (doctree != NULL)
113-
xmlFreeDoc(doctree);
114-
}
115-
PG_CATCH();
116-
{
117-
pg_xml_done(xmlerrcxt, true);
118-
119-
PG_RE_THROW();
120-
}
121-
PG_END_TRY();
122-
123-
pg_xml_done(xmlerrcxt, false);
124-
125-
PG_RETURN_BOOL(result);
126-
}
127-
128-
12984
/* Encodes special characters (<, >, &, " and \r) as XML entities */
13085

13186
PG_FUNCTION_INFO_V1(xml_encode_special_chars);

doc/src/sgml/xml2.sgml

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<row>
5454
<entry>
5555
<function>
56-
xml_is_well_formed(document)
56+
xml_valid(document)
5757
</function>
5858
</entry>
5959
<entry>
@@ -62,10 +62,10 @@
6262
<entry>
6363
<para>
6464
This parses the document text in its parameter and returns true if the
65-
document is well-formed XML. (Note: before PostgreSQL 8.2, this
66-
function was called <function>xml_valid()</>. That is the wrong name
67-
since validity and well-formedness have different meanings in XML.
68-
The old name is still available, but is deprecated.)
65+
document is well-formed XML. (Note: this is an alias for the standard
66+
PostgreSQL function <function>xml_is_well_formed()</>. The
67+
name <function>xml_valid()</> is technically incorrect since validity
68+
and well-formedness have different meanings in XML.)
6969
</para>
7070
</entry>
7171
</row>

0 commit comments

Comments
 (0)