Skip to content

Commit fd2abeb

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. Eleven years seems like enough time for people to have updated to the extension-style version of the xml2 module, so let's drop this. We did this once before, in 2054071, and then reverted it because the intended change of PGDLLEXPORT markings didn't happen. This time the reason is to suppress link-time duplicate-symbol warnings on AIX. That's not worth a lot perhaps, but the value of keeping this function has surely dropped to about zero by now. Discussion: https://postgr.es/m/2717731.1644778752@sss.pgh.pa.us
1 parent 50e5bc5 commit fd2abeb

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

contrib/xml2/xpath.c

Lines changed: 0 additions & 45 deletions
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_PP(0); /* document buffer */
99-
bool result = false;
100-
int32 docsize = VARSIZE_ANY_EXHDR(t);
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_ANY(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);

0 commit comments

Comments
 (0)