Delete contrib/xml2's legacy implementation of xml_is_well_formed().
authorTom Lane <[email protected]>
Fri, 4 Nov 2016 22:29:53 +0000 (18:29 -0400)
committerTom Lane <[email protected]>
Fri, 4 Nov 2016 22:29:53 +0000 (18:29 -0400)
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>

contrib/xml2/xpath.c
doc/src/sgml/xml2.sgml

index ac28996867b36aec60ca77ba5ba477cad5c005c1..28445be3690922d378f8fb80b81d25324d826b23 100644 (file)
@@ -81,51 +81,6 @@ pgxml_parser_init(PgXmlStrictness strictness)
 }
 
 
-/*
- * Returns true if document is well-formed
- *
- * Note: this has been superseded by a core function.  We still have to
- * have it in the contrib module so that existing SQL-level references
- * to the function won't fail; but in normal usage with up-to-date SQL
- * definitions for the contrib module, this won't be called.
- */
-
-PG_FUNCTION_INFO_V1(xml_is_well_formed);
-
-Datum
-xml_is_well_formed(PG_FUNCTION_ARGS)
-{
-   text       *t = PG_GETARG_TEXT_P(0);        /* document buffer */
-   bool        result = false;
-   int32       docsize = VARSIZE(t) - VARHDRSZ;
-   xmlDocPtr   doctree;
-   PgXmlErrorContext *xmlerrcxt;
-
-   xmlerrcxt = pgxml_parser_init(PG_XML_STRICTNESS_LEGACY);
-
-   PG_TRY();
-   {
-       doctree = xmlParseMemory((char *) VARDATA(t), docsize);
-
-       result = (doctree != NULL);
-
-       if (doctree != NULL)
-           xmlFreeDoc(doctree);
-   }
-   PG_CATCH();
-   {
-       pg_xml_done(xmlerrcxt, true);
-
-       PG_RE_THROW();
-   }
-   PG_END_TRY();
-
-   pg_xml_done(xmlerrcxt, false);
-
-   PG_RETURN_BOOL(result);
-}
-
-
 /* Encodes special characters (<, >, &, " and \r) as XML entities */
 
 PG_FUNCTION_INFO_V1(xml_encode_special_chars);
index a40172c36d2084cce1483e5c081f52d215d6c882..9bbc9e75d78ad92c09597d5825f93c2eb7148b76 100644 (file)
@@ -53,7 +53,7 @@
      <row>
       <entry>
        <function>
-        xml_is_well_formed(document)
+        xml_valid(document)
        </function>
       </entry>
       <entry>
       <entry>
        <para>
         This parses the document text in its parameter and returns true if the
-        document is well-formed XML.  (Note: before PostgreSQL 8.2, this
-        function was called <function>xml_valid()</>.  That is the wrong name
-        since validity and well-formedness have different meanings in XML.
-        The old name is still available, but is deprecated.)
+        document is well-formed XML.  (Note: this is an alias for the standard
+        PostgreSQL function <function>xml_is_well_formed()</>.  The
+        name <function>xml_valid()</> is technically incorrect since validity
+        and well-formedness have different meanings in XML.)
        </para>
       </entry>
      </row>