aboutsummaryrefslogtreecommitdiff
path: root/contrib/xml2
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/xml2')
-rw-r--r--contrib/xml2/.gitignore1
-rw-r--r--contrib/xml2/Makefile8
-rw-r--r--contrib/xml2/expected/xml2.out8
-rw-r--r--contrib/xml2/expected/xml2_1.out8
-rw-r--r--contrib/xml2/sql/xml2.sql10
-rw-r--r--contrib/xml2/uninstall_pgxml.sql31
-rw-r--r--contrib/xml2/xml2--1.0.sql (renamed from contrib/xml2/pgxml.sql.in)5
-rw-r--r--contrib/xml2/xml2--unpackaged--1.0.sql16
-rw-r--r--contrib/xml2/xml2.control5
9 files changed, 29 insertions, 63 deletions
diff --git a/contrib/xml2/.gitignore b/contrib/xml2/.gitignore
index 5ef9dbf4d4b..19b6c5ba425 100644
--- a/contrib/xml2/.gitignore
+++ b/contrib/xml2/.gitignore
@@ -1,3 +1,2 @@
-/pgxml.sql
# Generated subdirectories
/results/
diff --git a/contrib/xml2/Makefile b/contrib/xml2/Makefile
index 57b4cbfac5d..ad325723c99 100644
--- a/contrib/xml2/Makefile
+++ b/contrib/xml2/Makefile
@@ -1,15 +1,15 @@
# contrib/xml2/Makefile
MODULE_big = pgxml
-
OBJS = xpath.o xslt_proc.o
-SHLIB_LINK += $(filter -lxslt, $(LIBS)) $(filter -lxml2, $(LIBS))
+EXTENSION = xml2
+DATA = xml2--1.0.sql xml2--unpackaged--1.0.sql
-DATA_built = pgxml.sql
-DATA = uninstall_pgxml.sql
REGRESS = xml2
+SHLIB_LINK += $(filter -lxslt, $(LIBS)) $(filter -lxml2, $(LIBS))
+
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
diff --git a/contrib/xml2/expected/xml2.out b/contrib/xml2/expected/xml2.out
index 8ce04d0b848..3bf676fb400 100644
--- a/contrib/xml2/expected/xml2.out
+++ b/contrib/xml2/expected/xml2.out
@@ -1,10 +1,4 @@
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of pgxml.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION xml2;
select query_to_xml('select 1 as x',true,false,'');
query_to_xml
---------------------------------------------------------------
diff --git a/contrib/xml2/expected/xml2_1.out b/contrib/xml2/expected/xml2_1.out
index d2d243ada7d..fda626e08c7 100644
--- a/contrib/xml2/expected/xml2_1.out
+++ b/contrib/xml2/expected/xml2_1.out
@@ -1,10 +1,4 @@
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of pgxml.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION xml2;
select query_to_xml('select 1 as x',true,false,'');
query_to_xml
---------------------------------------------------------------
diff --git a/contrib/xml2/sql/xml2.sql b/contrib/xml2/sql/xml2.sql
index 5b3cc997f50..4a996af7167 100644
--- a/contrib/xml2/sql/xml2.sql
+++ b/contrib/xml2/sql/xml2.sql
@@ -1,12 +1,4 @@
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of pgxml.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i pgxml.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION xml2;
select query_to_xml('select 1 as x',true,false,'');
diff --git a/contrib/xml2/uninstall_pgxml.sql b/contrib/xml2/uninstall_pgxml.sql
deleted file mode 100644
index 1696390f80d..00000000000
--- a/contrib/xml2/uninstall_pgxml.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-/* contrib/xml2/uninstall_pgxml.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION xslt_process(text,text);
-
-DROP FUNCTION xslt_process(text,text,text);
-
-DROP FUNCTION xpath_table(text,text,text,text,text);
-
-DROP FUNCTION xpath_nodeset(text,text,text);
-
-DROP FUNCTION xpath_nodeset(text,text);
-
-DROP FUNCTION xpath_list(text,text);
-
-DROP FUNCTION xpath_list(text,text,text);
-
-DROP FUNCTION xpath_bool(text,text);
-
-DROP FUNCTION xpath_number(text,text);
-
-DROP FUNCTION xpath_nodeset(text,text,text,text);
-
-DROP FUNCTION xpath_string(text,text);
-
-DROP FUNCTION xml_encode_special_chars(text);
-
--- deprecated old name for xml_is_well_formed
-DROP FUNCTION xml_valid(text);
diff --git a/contrib/xml2/pgxml.sql.in b/contrib/xml2/xml2--1.0.sql
index 8c3d420afd3..100f57291fa 100644
--- a/contrib/xml2/pgxml.sql.in
+++ b/contrib/xml2/xml2--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/xml2/pgxml.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/xml2/xml2--1.0.sql */
--SQL for XML parser
diff --git a/contrib/xml2/xml2--unpackaged--1.0.sql b/contrib/xml2/xml2--unpackaged--1.0.sql
new file mode 100644
index 00000000000..a4716cf9168
--- /dev/null
+++ b/contrib/xml2/xml2--unpackaged--1.0.sql
@@ -0,0 +1,16 @@
+/* contrib/xml2/xml2--unpackaged--1.0.sql */
+
+ALTER EXTENSION xml2 ADD function xslt_process(text,text);
+ALTER EXTENSION xml2 ADD function xslt_process(text,text,text);
+ALTER EXTENSION xml2 ADD function xpath_table(text,text,text,text,text);
+ALTER EXTENSION xml2 ADD function xpath_nodeset(text,text,text);
+ALTER EXTENSION xml2 ADD function xpath_nodeset(text,text);
+ALTER EXTENSION xml2 ADD function xpath_list(text,text);
+ALTER EXTENSION xml2 ADD function xpath_list(text,text,text);
+ALTER EXTENSION xml2 ADD function xpath_bool(text,text);
+ALTER EXTENSION xml2 ADD function xpath_number(text,text);
+ALTER EXTENSION xml2 ADD function xpath_nodeset(text,text,text,text);
+ALTER EXTENSION xml2 ADD function xpath_string(text,text);
+ALTER EXTENSION xml2 ADD function xml_encode_special_chars(text);
+ALTER EXTENSION xml2 ADD function xml_valid(text);
+ALTER EXTENSION xml2 ADD function xml_is_well_formed(text);
diff --git a/contrib/xml2/xml2.control b/contrib/xml2/xml2.control
new file mode 100644
index 00000000000..004649d6520
--- /dev/null
+++ b/contrib/xml2/xml2.control
@@ -0,0 +1,5 @@
+# xml2 extension
+comment = 'XPath querying and XSLT'
+default_version = '1.0'
+module_pathname = '$libdir/pgxml'
+relocatable = true