diff --git a/configure b/configure
index 78a10c8c8854169848920defd52e18e83067b2b4..5449d02c9b24d6a926bc8212faf8babcfe9ac8fc 100755
--- a/configure
+++ b/configure
@@ -23843,75 +23843,6 @@ fi
 
 
 
-# Older versions of libxml2 lack the xmlStructuredErrorContext variable
-# (which could be a macro referring to a function, if threading is enabled)
-if test "$with_libxml" = yes ; then
-  { $as_echo "$as_me:$LINENO: checking for xmlStructuredErrorContext" >&5
-$as_echo_n "checking for xmlStructuredErrorContext... " >&6; }
-if test "${pgac_cv_libxml_structerrctx+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libxml/globals.h>
-                void *globptr;
-int
-main ()
-{
-globptr = xmlStructuredErrorContext
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  pgac_cv_libxml_structerrctx=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	pgac_cv_libxml_structerrctx=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $pgac_cv_libxml_structerrctx" >&5
-$as_echo "$pgac_cv_libxml_structerrctx" >&6; }
-  if test x"$pgac_cv_libxml_structerrctx" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_XMLSTRUCTUREDERRORCONTEXT 1
-_ACEOF
-
-  fi
-fi
-
-
 # This test makes sure that run tests work at all.  Sometimes a shared
 # library is found by the linker, but the runtime linker can't find it.
 # This check should come after all modifications of compiler or linker
diff --git a/configure.in b/configure.in
index 8ed09f58ab5c8451a39138a9904b7895b1824d66..fa48a2b20749d2669a3120f5afee7caa2b8dfe13 100644
--- a/configure.in
+++ b/configure.in
@@ -1539,23 +1539,6 @@ AC_SUBST(LDAP_LIBS_FE)
 AC_SUBST(LDAP_LIBS_BE)
 
 
-# Older versions of libxml2 lack the xmlStructuredErrorContext variable
-# (which could be a macro referring to a function, if threading is enabled)
-if test "$with_libxml" = yes ; then
-  AC_CACHE_CHECK([for xmlStructuredErrorContext], pgac_cv_libxml_structerrctx,
-  [AC_TRY_LINK([#include <libxml/globals.h>
-                void *globptr;],
-               [globptr = xmlStructuredErrorContext],
-               [pgac_cv_libxml_structerrctx=yes],
-               [pgac_cv_libxml_structerrctx=no])])
-  if test x"$pgac_cv_libxml_structerrctx" = x"yes"; then
-    AC_DEFINE(HAVE_XMLSTRUCTUREDERRORCONTEXT,
-             1,
-             [Define to 1 if your libxml has xmlStructuredErrorContext.])
-  fi
-fi
-
-
 # This test makes sure that run tests work at all.  Sometimes a shared
 # library is found by the linker, but the runtime linker can't find it.
 # This check should come after all modifications of compiler or linker
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index a358de68728fbb5b4dba125824b68f07e0842f55..2d945b9cdba5a86dea7e5eda7c3357311648bf3b 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -52,9 +52,19 @@
 #include <libxml/tree.h>
 #include <libxml/uri.h>
 #include <libxml/xmlerror.h>
+#include <libxml/xmlversion.h>
 #include <libxml/xmlwriter.h>
 #include <libxml/xpath.h>
 #include <libxml/xpathInternals.h>
+
+/*
+ * We used to check for xmlStructuredErrorContext via a configure test; but
+ * that doesn't work on Windows, so instead use this grottier method of
+ * testing the library version number.
+ */
+#if LIBXML_VERSION >= 20704
+#define HAVE_XMLSTRUCTUREDERRORCONTEXT 1
+#endif
 #endif   /* USE_LIBXML */
 
 #include "catalog/namespace.h"
@@ -970,7 +980,7 @@ pg_xml_init(PgXmlStrictness strictness)
 	 *
 	 * The only known situation in which this test fails is if we compile with
 	 * headers from a libxml2 that doesn't track the structured error context
-	 * separately (<= 2.7.3), but at runtime use a version that does, or vice
+	 * separately (< 2.7.4), but at runtime use a version that does, or vice
 	 * versa.  The libxml2 authors did not treat that change as constituting
 	 * an ABI break, so the LIBXML_TEST_VERSION test in pg_xml_init_library
 	 * fails to protect us from this.
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 915c318bd255f9b73461e405e86190fc8ab236fd..dbe28931f8a28466977d6275eacea7f3549e1f17 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -632,9 +632,6 @@
 /* Define to 1 if you have the <winldap.h> header file. */
 #undef HAVE_WINLDAP_H
 
-/* Define to 1 if your libxml has xmlStructuredErrorContext. */
-#undef HAVE_XMLSTRUCTUREDERRORCONTEXT
-
 /* Define to the appropriate snprintf format for 64-bit ints. */
 #undef INT64_FORMAT