summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/adminpack/.gitignore1
-rw-r--r--contrib/adminpack/Makefile7
-rw-r--r--contrib/adminpack/adminpack--1.0.sql (renamed from contrib/adminpack/adminpack.sql.in)2
-rw-r--r--contrib/adminpack/adminpack--unpackaged--1.0.sql10
-rw-r--r--contrib/adminpack/adminpack.control6
-rw-r--r--contrib/adminpack/uninstall_adminpack.sql10
-rw-r--r--contrib/btree_gin/.gitignore1
-rw-r--r--contrib/btree_gin/Makefile5
-rw-r--r--contrib/btree_gin/btree_gin--1.0.sql (renamed from contrib/btree_gin/btree_gin.sql.in)5
-rw-r--r--contrib/btree_gin/btree_gin--unpackaged--1.0.sql116
-rw-r--r--contrib/btree_gin/btree_gin.control5
-rw-r--r--contrib/btree_gin/expected/install_btree_gin.out4
-rw-r--r--contrib/btree_gin/sql/install_btree_gin.sql6
-rw-r--r--contrib/btree_gin/uninstall_btree_gin.sql98
-rw-r--r--contrib/btree_gist/.gitignore1
-rw-r--r--contrib/btree_gist/Makefile4
-rw-r--r--contrib/btree_gist/btree_gist--1.0.sql (renamed from contrib/btree_gist/btree_gist.sql.in)5
-rw-r--r--contrib/btree_gist/btree_gist--unpackaged--1.0.sql172
-rw-r--r--contrib/btree_gist/btree_gist.control5
-rw-r--r--contrib/btree_gist/expected/init.out8
-rw-r--r--contrib/btree_gist/sql/init.sql10
-rw-r--r--contrib/btree_gist/uninstall_btree_gist.sql280
-rw-r--r--contrib/chkpass/.gitignore1
-rw-r--r--contrib/chkpass/Makefile6
-rw-r--r--contrib/chkpass/chkpass--1.0.sql (renamed from contrib/chkpass/chkpass.sql.in)5
-rw-r--r--contrib/chkpass/chkpass--unpackaged--1.0.sql10
-rw-r--r--contrib/chkpass/chkpass.control5
-rw-r--r--contrib/chkpass/uninstall_chkpass.sql16
-rw-r--r--contrib/citext/.gitignore1
-rw-r--r--contrib/citext/Makefile6
-rw-r--r--contrib/citext/citext--1.0.sql (renamed from contrib/citext/citext.sql.in)5
-rw-r--r--contrib/citext/citext--unpackaged--1.0.sql76
-rw-r--r--contrib/citext/citext.control5
-rw-r--r--contrib/citext/expected/citext.out7
-rw-r--r--contrib/citext/expected/citext_1.out7
-rw-r--r--contrib/citext/sql/citext.sql10
-rw-r--r--contrib/citext/uninstall_citext.sql80
-rw-r--r--contrib/cube/.gitignore1
-rw-r--r--contrib/cube/Makefile5
-rw-r--r--contrib/cube/cube--1.0.sql (renamed from contrib/cube/cube.sql.in)6
-rw-r--r--contrib/cube/cube--unpackaged--1.0.sql53
-rw-r--r--contrib/cube/cube.control5
-rw-r--r--contrib/cube/expected/cube.out8
-rw-r--r--contrib/cube/expected/cube_1.out8
-rw-r--r--contrib/cube/expected/cube_2.out8
-rw-r--r--contrib/cube/sql/cube.sql10
-rw-r--r--contrib/cube/uninstall_cube.sql98
-rw-r--r--contrib/dblink/.gitignore1
-rw-r--r--contrib/dblink/Makefile8
-rw-r--r--contrib/dblink/dblink--1.0.sql (renamed from contrib/dblink/dblink.sql.in)5
-rw-r--r--contrib/dblink/dblink--unpackaged--1.0.sql43
-rw-r--r--contrib/dblink/dblink.control5
-rw-r--r--contrib/dblink/expected/dblink.out12
-rw-r--r--contrib/dblink/sql/dblink.sql15
-rw-r--r--contrib/dblink/uninstall_dblink.sql86
-rw-r--r--contrib/dict_int/.gitignore1
-rw-r--r--contrib/dict_int/Makefile6
-rw-r--r--contrib/dict_int/dict_int--1.0.sql (renamed from contrib/dict_int/dict_int.sql.in)5
-rw-r--r--contrib/dict_int/dict_int--unpackaged--1.0.sql6
-rw-r--r--contrib/dict_int/dict_int.control5
-rw-r--r--contrib/dict_int/expected/dict_int.out8
-rw-r--r--contrib/dict_int/sql/dict_int.sql10
-rw-r--r--contrib/dict_int/uninstall_dict_int.sql12
-rw-r--r--contrib/dict_xsyn/.gitignore1
-rw-r--r--contrib/dict_xsyn/Makefile6
-rw-r--r--contrib/dict_xsyn/dict_xsyn--1.0.sql (renamed from contrib/dict_xsyn/dict_xsyn.sql.in)5
-rw-r--r--contrib/dict_xsyn/dict_xsyn--unpackaged--1.0.sql6
-rw-r--r--contrib/dict_xsyn/dict_xsyn.control5
-rw-r--r--contrib/dict_xsyn/expected/dict_xsyn.out8
-rw-r--r--contrib/dict_xsyn/sql/dict_xsyn.sql10
-rw-r--r--contrib/dict_xsyn/uninstall_dict_xsyn.sql12
-rw-r--r--contrib/earthdistance/.gitignore1
-rw-r--r--contrib/earthdistance/Makefile6
-rw-r--r--contrib/earthdistance/earthdistance--1.0.sql (renamed from contrib/earthdistance/earthdistance.sql.in)7
-rw-r--r--contrib/earthdistance/earthdistance--unpackaged--1.0.sql13
-rw-r--r--contrib/earthdistance/earthdistance.control6
-rw-r--r--contrib/earthdistance/expected/earthdistance.out9
-rw-r--r--contrib/earthdistance/sql/earthdistance.sql12
-rw-r--r--contrib/earthdistance/uninstall_earthdistance.sql26
-rw-r--r--contrib/fuzzystrmatch/.gitignore1
-rw-r--r--contrib/fuzzystrmatch/Makefile5
-rw-r--r--contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql (renamed from contrib/fuzzystrmatch/fuzzystrmatch.sql.in)5
-rw-r--r--contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql12
-rw-r--r--contrib/fuzzystrmatch/fuzzystrmatch.control5
-rw-r--r--contrib/fuzzystrmatch/uninstall_fuzzystrmatch.sql24
-rw-r--r--contrib/hstore/.gitignore1
-rw-r--r--contrib/hstore/Makefile5
-rw-r--r--contrib/hstore/expected/hstore.out10
-rw-r--r--contrib/hstore/hstore--1.0.sql (renamed from contrib/hstore/hstore.sql.in)5
-rw-r--r--contrib/hstore/hstore--unpackaged--1.0.sql89
-rw-r--r--contrib/hstore/hstore.control5
-rw-r--r--contrib/hstore/sql/hstore.sql10
-rw-r--r--contrib/hstore/uninstall_hstore.sql86
-rw-r--r--contrib/intagg/Makefile3
-rw-r--r--contrib/intagg/int_aggregate--1.0.sql (renamed from contrib/intagg/int_aggregate.sql)5
-rw-r--r--contrib/intagg/int_aggregate--unpackaged--1.0.sql6
-rw-r--r--contrib/intagg/int_aggregate.control4
-rw-r--r--contrib/intagg/uninstall_int_aggregate.sql12
-rw-r--r--contrib/intarray/.gitignore1
-rw-r--r--contrib/intarray/Makefile6
-rw-r--r--contrib/intarray/expected/_int.out8
-rw-r--r--contrib/intarray/intarray--1.0.sql (renamed from contrib/intarray/_int.sql.in)5
-rw-r--r--contrib/intarray/intarray--unpackaged--1.0.sql71
-rw-r--r--contrib/intarray/intarray.control5
-rw-r--r--contrib/intarray/sql/_int.sql10
-rw-r--r--contrib/intarray/uninstall__int.sql128
-rw-r--r--contrib/isn/.gitignore1
-rw-r--r--contrib/isn/Makefile5
-rw-r--r--contrib/isn/isn--1.0.sql (renamed from contrib/isn/isn.sql.in)5
-rw-r--r--contrib/isn/isn--unpackaged--1.0.sql461
-rw-r--r--contrib/isn/isn.control5
-rw-r--r--contrib/isn/uninstall_isn.sql24
-rw-r--r--contrib/lo/.gitignore1
-rw-r--r--contrib/lo/Makefile5
-rw-r--r--contrib/lo/lo--1.0.sql (renamed from contrib/lo/lo.sql.in)5
-rw-r--r--contrib/lo/lo--unpackaged--1.0.sql5
-rw-r--r--contrib/lo/lo.control5
-rw-r--r--contrib/lo/uninstall_lo.sql17
-rw-r--r--contrib/ltree/.gitignore1
-rw-r--r--contrib/ltree/Makefile8
-rw-r--r--contrib/ltree/expected/ltree.out8
-rw-r--r--contrib/ltree/ltree--1.0.sql (renamed from contrib/ltree/ltree.sql.in)5
-rw-r--r--contrib/ltree/ltree--unpackaged--1.0.sql131
-rw-r--r--contrib/ltree/ltree.control5
-rw-r--r--contrib/ltree/sql/ltree.sql10
-rw-r--r--contrib/ltree/uninstall_ltree.sql240
-rw-r--r--contrib/pageinspect/.gitignore1
-rw-r--r--contrib/pageinspect/Makefile11
-rw-r--r--contrib/pageinspect/pageinspect--1.0.sql (renamed from contrib/pageinspect/pageinspect.sql.in)5
-rw-r--r--contrib/pageinspect/pageinspect--unpackaged--1.0.sql10
-rw-r--r--contrib/pageinspect/pageinspect.control5
-rw-r--r--contrib/pageinspect/uninstall_pageinspect.sql13
-rw-r--r--contrib/pg_buffercache/.gitignore1
-rw-r--r--contrib/pg_buffercache/Makefile4
-rw-r--r--contrib/pg_buffercache/pg_buffercache--1.0.sql (renamed from contrib/pg_buffercache/pg_buffercache.sql.in)7
-rw-r--r--contrib/pg_buffercache/pg_buffercache--unpackaged--1.0.sql4
-rw-r--r--contrib/pg_buffercache/pg_buffercache.control5
-rw-r--r--contrib/pg_buffercache/uninstall_pg_buffercache.sql8
-rw-r--r--contrib/pg_freespacemap/.gitignore1
-rw-r--r--contrib/pg_freespacemap/Makefile4
-rw-r--r--contrib/pg_freespacemap/pg_freespacemap--1.0.sql (renamed from contrib/pg_freespacemap/pg_freespacemap.sql.in)6
-rw-r--r--contrib/pg_freespacemap/pg_freespacemap--unpackaged--1.0.sql4
-rw-r--r--contrib/pg_freespacemap/pg_freespacemap.control5
-rw-r--r--contrib/pg_freespacemap/uninstall_pg_freespacemap.sql7
-rw-r--r--contrib/pg_stat_statements/.gitignore1
-rw-r--r--contrib/pg_stat_statements/Makefile5
-rw-r--r--contrib/pg_stat_statements/pg_stat_statements--1.0.sql (renamed from contrib/pg_stat_statements/pg_stat_statements.sql.in)5
-rw-r--r--contrib/pg_stat_statements/pg_stat_statements--unpackaged--1.0.sql5
-rw-r--r--contrib/pg_stat_statements/pg_stat_statements.control5
-rw-r--r--contrib/pg_stat_statements/uninstall_pg_stat_statements.sql8
-rw-r--r--contrib/pg_test_fsync/Makefile3
-rw-r--r--contrib/pg_trgm/.gitignore1
-rw-r--r--contrib/pg_trgm/Makefile5
-rw-r--r--contrib/pg_trgm/expected/pg_trgm.out8
-rw-r--r--contrib/pg_trgm/pg_trgm--1.0.sql (renamed from contrib/pg_trgm/pg_trgm.sql.in)5
-rw-r--r--contrib/pg_trgm/pg_trgm--unpackaged--1.0.sql28
-rw-r--r--contrib/pg_trgm/pg_trgm.control5
-rw-r--r--contrib/pg_trgm/sql/pg_trgm.sql10
-rw-r--r--contrib/pg_trgm/uninstall_pg_trgm.sql48
-rw-r--r--contrib/pg_upgrade/Makefile3
-rw-r--r--contrib/pg_upgrade_support/Makefile3
-rw-r--r--contrib/pgcrypto/.gitignore1
-rw-r--r--contrib/pgcrypto/Makefile9
-rw-r--r--contrib/pgcrypto/expected/init.out8
-rw-r--r--contrib/pgcrypto/pgcrypto--1.0.sql (renamed from contrib/pgcrypto/pgcrypto.sql.in)5
-rw-r--r--contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql35
-rw-r--r--contrib/pgcrypto/pgcrypto.control5
-rw-r--r--contrib/pgcrypto/sql/init.sql10
-rw-r--r--contrib/pgcrypto/uninstall_pgcrypto.sql45
-rw-r--r--contrib/pgrowlocks/.gitignore1
-rw-r--r--contrib/pgrowlocks/Makefile11
-rw-r--r--contrib/pgrowlocks/pgrowlocks--1.0.sql (renamed from contrib/pgrowlocks/pgrowlocks.sql.in)5
-rw-r--r--contrib/pgrowlocks/pgrowlocks--unpackaged--1.0.sql3
-rw-r--r--contrib/pgrowlocks/pgrowlocks.control5
-rw-r--r--contrib/pgrowlocks/uninstall_pgrowlocks.sql6
-rw-r--r--contrib/pgstattuple/.gitignore1
-rw-r--r--contrib/pgstattuple/Makefile11
-rw-r--r--contrib/pgstattuple/pgstattuple--1.0.sql (renamed from contrib/pgstattuple/pgstattuple.sql.in)5
-rw-r--r--contrib/pgstattuple/pgstattuple--unpackaged--1.0.sql6
-rw-r--r--contrib/pgstattuple/pgstattuple.control5
-rw-r--r--contrib/pgstattuple/uninstall_pgstattuple.sql9
-rw-r--r--contrib/seg/.gitignore1
-rw-r--r--contrib/seg/Makefile6
-rw-r--r--contrib/seg/expected/seg.out8
-rw-r--r--contrib/seg/expected/seg_1.out8
-rw-r--r--contrib/seg/seg--1.0.sql (renamed from contrib/seg/seg.sql.in)6
-rw-r--r--contrib/seg/seg--unpackaged--1.0.sql51
-rw-r--r--contrib/seg/seg.control5
-rw-r--r--contrib/seg/sql/seg.sql10
-rw-r--r--contrib/seg/uninstall_seg.sql94
-rw-r--r--contrib/spi/.gitignore5
-rw-r--r--contrib/spi/Makefile10
-rw-r--r--contrib/spi/autoinc--1.0.sql6
-rw-r--r--contrib/spi/autoinc--unpackaged--1.0.sql3
-rw-r--r--contrib/spi/autoinc.control5
-rw-r--r--contrib/spi/autoinc.sql.in9
-rw-r--r--contrib/spi/insert_username--1.0.sql6
-rw-r--r--contrib/spi/insert_username--unpackaged--1.0.sql3
-rw-r--r--contrib/spi/insert_username.control5
-rw-r--r--contrib/spi/insert_username.sql.in9
-rw-r--r--contrib/spi/moddatetime--1.0.sql6
-rw-r--r--contrib/spi/moddatetime--unpackaged--1.0.sql3
-rw-r--r--contrib/spi/moddatetime.control5
-rw-r--r--contrib/spi/moddatetime.sql.in9
-rw-r--r--contrib/spi/refint--1.0.sql (renamed from contrib/spi/refint.sql.in)5
-rw-r--r--contrib/spi/refint--unpackaged--1.0.sql4
-rw-r--r--contrib/spi/refint.control5
-rw-r--r--contrib/spi/timetravel--1.0.sql (renamed from contrib/spi/timetravel.sql.in)5
-rw-r--r--contrib/spi/timetravel--unpackaged--1.0.sql5
-rw-r--r--contrib/spi/timetravel.control5
-rw-r--r--contrib/sslinfo/.gitignore1
-rw-r--r--contrib/sslinfo/Makefile5
-rw-r--r--contrib/sslinfo/sslinfo--1.0.sql (renamed from contrib/sslinfo/sslinfo.sql.in)5
-rw-r--r--contrib/sslinfo/sslinfo--unpackaged--1.0.sql11
-rw-r--r--contrib/sslinfo/sslinfo.control5
-rw-r--r--contrib/sslinfo/uninstall_sslinfo.sql14
-rw-r--r--contrib/tablefunc/.gitignore1
-rw-r--r--contrib/tablefunc/Makefile6
-rw-r--r--contrib/tablefunc/expected/tablefunc.out8
-rw-r--r--contrib/tablefunc/sql/tablefunc.sql10
-rw-r--r--contrib/tablefunc/tablefunc--1.0.sql (renamed from contrib/tablefunc/tablefunc.sql.in)5
-rw-r--r--contrib/tablefunc/tablefunc--unpackaged--1.0.sql16
-rw-r--r--contrib/tablefunc/tablefunc.control5
-rw-r--r--contrib/tablefunc/uninstall_tablefunc.sql32
-rw-r--r--contrib/test_parser/.gitignore1
-rw-r--r--contrib/test_parser/Makefile6
-rw-r--r--contrib/test_parser/expected/test_parser.out8
-rw-r--r--contrib/test_parser/sql/test_parser.sql10
-rw-r--r--contrib/test_parser/test_parser--1.0.sql (renamed from contrib/test_parser/test_parser.sql.in)5
-rw-r--r--contrib/test_parser/test_parser--unpackaged--1.0.sql7
-rw-r--r--contrib/test_parser/test_parser.control5
-rw-r--r--contrib/test_parser/uninstall_test_parser.sql14
-rw-r--r--contrib/tsearch2/.gitignore1
-rw-r--r--contrib/tsearch2/Makefile6
-rw-r--r--contrib/tsearch2/expected/tsearch2.out8
-rw-r--r--contrib/tsearch2/expected/tsearch2_1.out8
-rw-r--r--contrib/tsearch2/sql/tsearch2.sql10
-rw-r--r--contrib/tsearch2/tsearch2--1.0.sql (renamed from contrib/tsearch2/tsearch2.sql.in)5
-rw-r--r--contrib/tsearch2/tsearch2--unpackaged--1.0.sql100
-rw-r--r--contrib/tsearch2/tsearch2.control5
-rw-r--r--contrib/tsearch2/uninstall_tsearch2.sql96
-rw-r--r--contrib/unaccent/.gitignore1
-rw-r--r--contrib/unaccent/Makefile5
-rw-r--r--contrib/unaccent/expected/unaccent.out4
-rw-r--r--contrib/unaccent/sql/unaccent.sql6
-rw-r--r--contrib/unaccent/unaccent--1.0.sql (renamed from contrib/unaccent/unaccent.sql.in)5
-rw-r--r--contrib/unaccent/unaccent--unpackaged--1.0.sql8
-rw-r--r--contrib/unaccent/unaccent.control5
-rw-r--r--contrib/unaccent/uninstall_unaccent.sql11
-rw-r--r--contrib/uuid-ossp/.gitignore1
-rw-r--r--contrib/uuid-ossp/Makefile5
-rw-r--r--contrib/uuid-ossp/uninstall_uuid-ossp.sql16
-rw-r--r--contrib/uuid-ossp/uuid-ossp--1.0.sql (renamed from contrib/uuid-ossp/uuid-ossp.sql.in)5
-rw-r--r--contrib/uuid-ossp/uuid-ossp--unpackaged--1.0.sql12
-rw-r--r--contrib/uuid-ossp/uuid-ossp.control5
-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
264 files changed, 2026 insertions, 2349 deletions
diff --git a/contrib/adminpack/.gitignore b/contrib/adminpack/.gitignore
deleted file mode 100644
index ea9a442f3a..0000000000
--- a/contrib/adminpack/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/adminpack.sql
diff --git a/contrib/adminpack/Makefile b/contrib/adminpack/Makefile
index d4413ad133..a127653d70 100644
--- a/contrib/adminpack/Makefile
+++ b/contrib/adminpack/Makefile
@@ -1,10 +1,11 @@
# contrib/adminpack/Makefile
MODULE_big = adminpack
-PG_CPPFLAGS = -I$(libpq_srcdir)
-DATA_built = adminpack.sql
-DATA = uninstall_adminpack.sql
OBJS = adminpack.o
+PG_CPPFLAGS = -I$(libpq_srcdir)
+
+EXTENSION = adminpack
+DATA = adminpack--1.0.sql adminpack--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/adminpack/adminpack.sql.in b/contrib/adminpack/adminpack--1.0.sql
index 6e389975d0..0502a4c01f 100644
--- a/contrib/adminpack/adminpack.sql.in
+++ b/contrib/adminpack/adminpack--1.0.sql
@@ -1,4 +1,4 @@
-/* contrib/adminpack/adminpack.sql.in */
+/* contrib/adminpack/adminpack--1.0.sql */
/* ***********************************************
* Administrative functions for PostgreSQL
diff --git a/contrib/adminpack/adminpack--unpackaged--1.0.sql b/contrib/adminpack/adminpack--unpackaged--1.0.sql
new file mode 100644
index 0000000000..d1c6aade9c
--- /dev/null
+++ b/contrib/adminpack/adminpack--unpackaged--1.0.sql
@@ -0,0 +1,10 @@
+/* contrib/adminpack/adminpack--unpackaged--1.0.sql */
+
+ALTER EXTENSION adminpack ADD function pg_catalog.pg_file_write(text,text,boolean);
+ALTER EXTENSION adminpack ADD function pg_catalog.pg_file_rename(text,text,text);
+ALTER EXTENSION adminpack ADD function pg_catalog.pg_file_rename(text,text);
+ALTER EXTENSION adminpack ADD function pg_catalog.pg_file_unlink(text);
+ALTER EXTENSION adminpack ADD function pg_catalog.pg_logdir_ls();
+ALTER EXTENSION adminpack ADD function pg_catalog.pg_file_read(text,bigint,bigint);
+ALTER EXTENSION adminpack ADD function pg_catalog.pg_file_length(text);
+ALTER EXTENSION adminpack ADD function pg_catalog.pg_logfile_rotate();
diff --git a/contrib/adminpack/adminpack.control b/contrib/adminpack/adminpack.control
new file mode 100644
index 0000000000..c79413f378
--- /dev/null
+++ b/contrib/adminpack/adminpack.control
@@ -0,0 +1,6 @@
+# adminpack extension
+comment = 'administrative functions for PostgreSQL'
+default_version = '1.0'
+module_pathname = '$libdir/adminpack'
+relocatable = false
+schema = pg_catalog
diff --git a/contrib/adminpack/uninstall_adminpack.sql b/contrib/adminpack/uninstall_adminpack.sql
deleted file mode 100644
index 682cf67760..0000000000
--- a/contrib/adminpack/uninstall_adminpack.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-/* contrib/adminpack/uninstall_adminpack.sql */
-
-DROP FUNCTION pg_catalog.pg_file_write(text, text, bool) ;
-DROP FUNCTION pg_catalog.pg_file_rename(text, text, text) ;
-DROP FUNCTION pg_catalog.pg_file_rename(text, text) ;
-DROP FUNCTION pg_catalog.pg_file_unlink(text) ;
-DROP FUNCTION pg_catalog.pg_logdir_ls() ;
-DROP FUNCTION pg_catalog.pg_file_read(text, bigint, bigint) ;
-DROP FUNCTION pg_catalog.pg_file_length(text) ;
-DROP FUNCTION pg_catalog.pg_logfile_rotate() ;
diff --git a/contrib/btree_gin/.gitignore b/contrib/btree_gin/.gitignore
index 7cebcf00f8..19b6c5ba42 100644
--- a/contrib/btree_gin/.gitignore
+++ b/contrib/btree_gin/.gitignore
@@ -1,3 +1,2 @@
-/btree_gin.sql
# Generated subdirectories
/results/
diff --git a/contrib/btree_gin/Makefile b/contrib/btree_gin/Makefile
index 8bc53f72da..09fd3e6e11 100644
--- a/contrib/btree_gin/Makefile
+++ b/contrib/btree_gin/Makefile
@@ -3,8 +3,9 @@
MODULE_big = btree_gin
OBJS = btree_gin.o
-DATA_built = btree_gin.sql
-DATA = uninstall_btree_gin.sql
+EXTENSION = btree_gin
+DATA = btree_gin--1.0.sql btree_gin--unpackaged--1.0.sql
+
REGRESS = install_btree_gin int2 int4 int8 float4 float8 money oid \
timestamp timestamptz time timetz date interval \
macaddr inet cidr text varchar char bytea bit varbit \
diff --git a/contrib/btree_gin/btree_gin.sql.in b/contrib/btree_gin/btree_gin--1.0.sql
index 19cc0b3df4..08bbff721f 100644
--- a/contrib/btree_gin/btree_gin.sql.in
+++ b/contrib/btree_gin/btree_gin--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/btree_gin/btree_gin.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/btree_gin/btree_gin--1.0.sql */
CREATE OR REPLACE FUNCTION gin_btree_consistent(internal, int2, anyelement, int4, internal, internal)
RETURNS bool
diff --git a/contrib/btree_gin/btree_gin--unpackaged--1.0.sql b/contrib/btree_gin/btree_gin--unpackaged--1.0.sql
new file mode 100644
index 0000000000..fe1ddeab87
--- /dev/null
+++ b/contrib/btree_gin/btree_gin--unpackaged--1.0.sql
@@ -0,0 +1,116 @@
+/* contrib/btree_gin/btree_gin--unpackaged--1.0.sql */
+
+ALTER EXTENSION btree_gin ADD function gin_btree_consistent(internal,smallint,anyelement,integer,internal,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_value_int2(smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_int2(smallint,smallint,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_int2(smallint,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family int2_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class int2_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_int4(integer,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_int4(integer,integer,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_int4(integer,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family int4_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class int4_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_int8(bigint,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_int8(bigint,bigint,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_int8(bigint,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family int8_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class int8_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_float4(real,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_float4(real,real,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_float4(real,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family float4_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class float4_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_float8(double precision,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_float8(double precision,double precision,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_float8(double precision,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family float8_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class float8_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_money(money,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_money(money,money,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_money(money,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family money_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class money_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_oid(oid,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_oid(oid,oid,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_oid(oid,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family oid_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class oid_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_timestamp(timestamp without time zone,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_timestamp(timestamp without time zone,timestamp without time zone,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_timestamp(timestamp without time zone,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family timestamp_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class timestamp_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_timestamptz(timestamp with time zone,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_timestamptz(timestamp with time zone,timestamp with time zone,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_timestamptz(timestamp with time zone,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family timestamptz_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class timestamptz_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_time(time without time zone,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_time(time without time zone,time without time zone,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_time(time without time zone,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family time_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class time_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_timetz(time with time zone,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_timetz(time with time zone,time with time zone,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_timetz(time with time zone,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family timetz_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class timetz_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_date(date,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_date(date,date,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_date(date,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family date_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class date_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_interval(interval,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_interval(interval,interval,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_interval(interval,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family interval_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class interval_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_macaddr(macaddr,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_macaddr(macaddr,macaddr,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_macaddr(macaddr,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family macaddr_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class macaddr_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_inet(inet,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_inet(inet,inet,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_inet(inet,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family inet_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class inet_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_cidr(cidr,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_cidr(cidr,cidr,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_cidr(cidr,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family cidr_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class cidr_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_text(text,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_text(text,text,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_text(text,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family text_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class text_ops using gin;
+ALTER EXTENSION btree_gin ADD operator family varchar_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class varchar_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_char("char",internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_char("char","char",smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_char("char",internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family char_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class char_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_bytea(bytea,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_bytea(bytea,bytea,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_bytea(bytea,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family bytea_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class bytea_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_bit(bit,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_bit(bit,bit,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_bit(bit,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family bit_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class bit_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_varbit(bit varying,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_varbit(bit varying,bit varying,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_varbit(bit varying,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD operator family varbit_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class varbit_ops using gin;
+ALTER EXTENSION btree_gin ADD function gin_extract_value_numeric(numeric,internal);
+ALTER EXTENSION btree_gin ADD function gin_compare_prefix_numeric(numeric,numeric,smallint,internal);
+ALTER EXTENSION btree_gin ADD function gin_extract_query_numeric(numeric,internal,smallint,internal,internal);
+ALTER EXTENSION btree_gin ADD function gin_numeric_cmp(numeric,numeric);
+ALTER EXTENSION btree_gin ADD operator family numeric_ops using gin;
+ALTER EXTENSION btree_gin ADD operator class numeric_ops using gin;
diff --git a/contrib/btree_gin/btree_gin.control b/contrib/btree_gin/btree_gin.control
new file mode 100644
index 0000000000..3b2cb2d709
--- /dev/null
+++ b/contrib/btree_gin/btree_gin.control
@@ -0,0 +1,5 @@
+# btree_gin extension
+comment = 'support for indexing common datatypes in GIN'
+default_version = '1.0'
+module_pathname = '$libdir/btree_gin'
+relocatable = true
diff --git a/contrib/btree_gin/expected/install_btree_gin.out b/contrib/btree_gin/expected/install_btree_gin.out
index 43f11fa263..0fae4c5bfe 100644
--- a/contrib/btree_gin/expected/install_btree_gin.out
+++ b/contrib/btree_gin/expected/install_btree_gin.out
@@ -1,3 +1 @@
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION btree_gin;
diff --git a/contrib/btree_gin/sql/install_btree_gin.sql b/contrib/btree_gin/sql/install_btree_gin.sql
index f54c8b4a0f..0fae4c5bfe 100644
--- a/contrib/btree_gin/sql/install_btree_gin.sql
+++ b/contrib/btree_gin/sql/install_btree_gin.sql
@@ -1,5 +1 @@
-SET client_min_messages = warning;
-\set ECHO none
-\i btree_gin.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION btree_gin;
diff --git a/contrib/btree_gin/uninstall_btree_gin.sql b/contrib/btree_gin/uninstall_btree_gin.sql
deleted file mode 100644
index 30324dc709..0000000000
--- a/contrib/btree_gin/uninstall_btree_gin.sql
+++ /dev/null
@@ -1,98 +0,0 @@
-/* contrib/btree_gin/uninstall_btree_gin.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP OPERATOR FAMILY int2_ops USING gin CASCADE;
-DROP OPERATOR FAMILY int4_ops USING gin CASCADE;
-DROP OPERATOR FAMILY int8_ops USING gin CASCADE;
-DROP OPERATOR FAMILY float4_ops USING gin CASCADE;
-DROP OPERATOR FAMILY float8_ops USING gin CASCADE;
-DROP OPERATOR FAMILY money_ops USING gin CASCADE;
-DROP OPERATOR FAMILY oid_ops USING gin CASCADE;
-DROP OPERATOR FAMILY timestamp_ops USING gin CASCADE;
-DROP OPERATOR FAMILY timestamptz_ops USING gin CASCADE;
-DROP OPERATOR FAMILY time_ops USING gin CASCADE;
-DROP OPERATOR FAMILY timetz_ops USING gin CASCADE;
-DROP OPERATOR FAMILY date_ops USING gin CASCADE;
-DROP OPERATOR FAMILY interval_ops USING gin CASCADE;
-DROP OPERATOR FAMILY macaddr_ops USING gin CASCADE;
-DROP OPERATOR FAMILY inet_ops USING gin CASCADE;
-DROP OPERATOR FAMILY cidr_ops USING gin CASCADE;
-DROP OPERATOR FAMILY text_ops USING gin CASCADE;
-DROP OPERATOR FAMILY varchar_ops USING gin CASCADE;
-DROP OPERATOR FAMILY char_ops USING gin CASCADE;
-DROP OPERATOR FAMILY bytea_ops USING gin CASCADE;
-DROP OPERATOR FAMILY bit_ops USING gin CASCADE;
-DROP OPERATOR FAMILY varbit_ops USING gin CASCADE;
-DROP OPERATOR FAMILY numeric_ops USING gin CASCADE;
-
-DROP FUNCTION gin_btree_consistent(internal, int2, anyelement, int4, internal, internal);
-
-DROP FUNCTION gin_extract_value_int2(int2, internal);
-DROP FUNCTION gin_compare_prefix_int2(int2, int2, int2, internal);
-DROP FUNCTION gin_extract_query_int2(int2, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_int4(int4, internal);
-DROP FUNCTION gin_compare_prefix_int4(int4, int4, int2, internal);
-DROP FUNCTION gin_extract_query_int4(int4, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_int8(int8, internal);
-DROP FUNCTION gin_compare_prefix_int8(int8, int8, int2, internal);
-DROP FUNCTION gin_extract_query_int8(int8, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_float4(float4, internal);
-DROP FUNCTION gin_compare_prefix_float4(float4, float4, int2, internal);
-DROP FUNCTION gin_extract_query_float4(float4, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_float8(float8, internal);
-DROP FUNCTION gin_compare_prefix_float8(float8, float8, int2, internal);
-DROP FUNCTION gin_extract_query_float8(float8, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_money(money, internal);
-DROP FUNCTION gin_compare_prefix_money(money, money, int2, internal);
-DROP FUNCTION gin_extract_query_money(money, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_oid(oid, internal);
-DROP FUNCTION gin_compare_prefix_oid(oid, oid, int2, internal);
-DROP FUNCTION gin_extract_query_oid(oid, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_timestamp(timestamp, internal);
-DROP FUNCTION gin_compare_prefix_timestamp(timestamp, timestamp, int2, internal);
-DROP FUNCTION gin_extract_query_timestamp(timestamp, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_timestamptz(timestamptz, internal);
-DROP FUNCTION gin_compare_prefix_timestamptz(timestamptz, timestamptz, int2, internal);
-DROP FUNCTION gin_extract_query_timestamptz(timestamptz, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_time(time, internal);
-DROP FUNCTION gin_compare_prefix_time(time, time, int2, internal);
-DROP FUNCTION gin_extract_query_time(time, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_timetz(timetz, internal);
-DROP FUNCTION gin_compare_prefix_timetz(timetz, timetz, int2, internal);
-DROP FUNCTION gin_extract_query_timetz(timetz, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_date(date, internal);
-DROP FUNCTION gin_compare_prefix_date(date, date, int2, internal);
-DROP FUNCTION gin_extract_query_date(date, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_interval(interval, internal);
-DROP FUNCTION gin_compare_prefix_interval(interval, interval, int2, internal);
-DROP FUNCTION gin_extract_query_interval(interval, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_macaddr(macaddr, internal);
-DROP FUNCTION gin_compare_prefix_macaddr(macaddr, macaddr, int2, internal);
-DROP FUNCTION gin_extract_query_macaddr(macaddr, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_inet(inet, internal);
-DROP FUNCTION gin_compare_prefix_inet(inet, inet, int2, internal);
-DROP FUNCTION gin_extract_query_inet(inet, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_cidr(cidr, internal);
-DROP FUNCTION gin_compare_prefix_cidr(cidr, cidr, int2, internal);
-DROP FUNCTION gin_extract_query_cidr(cidr, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_text(text, internal);
-DROP FUNCTION gin_compare_prefix_text(text, text, int2, internal);
-DROP FUNCTION gin_extract_query_text(text, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_char("char", internal);
-DROP FUNCTION gin_compare_prefix_char("char", "char", int2, internal);
-DROP FUNCTION gin_extract_query_char("char", internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_bytea(bytea, internal);
-DROP FUNCTION gin_compare_prefix_bytea(bytea, bytea, int2, internal);
-DROP FUNCTION gin_extract_query_bytea(bytea, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_bit(bit, internal);
-DROP FUNCTION gin_compare_prefix_bit(bit, bit, int2, internal);
-DROP FUNCTION gin_extract_query_bit(bit, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_varbit(varbit, internal);
-DROP FUNCTION gin_compare_prefix_varbit(varbit, varbit, int2, internal);
-DROP FUNCTION gin_extract_query_varbit(varbit, internal, int2, internal, internal);
-DROP FUNCTION gin_extract_value_numeric(numeric, internal);
-DROP FUNCTION gin_compare_prefix_numeric(numeric, numeric, int2, internal);
-DROP FUNCTION gin_extract_query_numeric(numeric, internal, int2, internal, internal);
-DROP FUNCTION gin_numeric_cmp(numeric, numeric);
diff --git a/contrib/btree_gist/.gitignore b/contrib/btree_gist/.gitignore
index 46318eaa7b..19b6c5ba42 100644
--- a/contrib/btree_gist/.gitignore
+++ b/contrib/btree_gist/.gitignore
@@ -1,3 +1,2 @@
-/btree_gist.sql
# Generated subdirectories
/results/
diff --git a/contrib/btree_gist/Makefile b/contrib/btree_gist/Makefile
index e152cd881d..4b931de08a 100644
--- a/contrib/btree_gist/Makefile
+++ b/contrib/btree_gist/Makefile
@@ -7,8 +7,8 @@ OBJS = btree_gist.o btree_utils_num.o btree_utils_var.o btree_int2.o btre
btree_date.o btree_interval.o btree_macaddr.o btree_inet.o btree_text.o \
btree_bytea.o btree_bit.o btree_numeric.o
-DATA_built = btree_gist.sql
-DATA = uninstall_btree_gist.sql
+EXTENSION = btree_gist
+DATA = btree_gist--1.0.sql btree_gist--unpackaged--1.0.sql
REGRESS = init int2 int4 int8 float4 float8 cash oid timestamp timestamptz time timetz \
date interval macaddr inet cidr text varchar char bytea bit varbit numeric not_equal
diff --git a/contrib/btree_gist/btree_gist.sql.in b/contrib/btree_gist/btree_gist--1.0.sql
index 01cd30f2de..ab6c8c3936 100644
--- a/contrib/btree_gist/btree_gist.sql.in
+++ b/contrib/btree_gist/btree_gist--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/btree_gist/btree_gist.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/btree_gist/btree_gist--1.0.sql */
CREATE OR REPLACE FUNCTION gbtreekey4_in(cstring)
RETURNS gbtreekey4
diff --git a/contrib/btree_gist/btree_gist--unpackaged--1.0.sql b/contrib/btree_gist/btree_gist--unpackaged--1.0.sql
new file mode 100644
index 0000000000..18c1464991
--- /dev/null
+++ b/contrib/btree_gist/btree_gist--unpackaged--1.0.sql
@@ -0,0 +1,172 @@
+/* contrib/btree_gist/btree_gist--unpackaged--1.0.sql */
+
+ALTER EXTENSION btree_gist ADD type gbtreekey4;
+ALTER EXTENSION btree_gist ADD function gbtreekey4_in(cstring);
+ALTER EXTENSION btree_gist ADD function gbtreekey4_out(gbtreekey4);
+ALTER EXTENSION btree_gist ADD type gbtreekey8;
+ALTER EXTENSION btree_gist ADD function gbtreekey8_in(cstring);
+ALTER EXTENSION btree_gist ADD function gbtreekey8_out(gbtreekey8);
+ALTER EXTENSION btree_gist ADD type gbtreekey16;
+ALTER EXTENSION btree_gist ADD function gbtreekey16_in(cstring);
+ALTER EXTENSION btree_gist ADD function gbtreekey16_out(gbtreekey16);
+ALTER EXTENSION btree_gist ADD type gbtreekey32;
+ALTER EXTENSION btree_gist ADD function gbtreekey32_in(cstring);
+ALTER EXTENSION btree_gist ADD function gbtreekey32_out(gbtreekey32);
+ALTER EXTENSION btree_gist ADD type gbtreekey_var;
+ALTER EXTENSION btree_gist ADD function gbtreekey_var_in(cstring);
+ALTER EXTENSION btree_gist ADD function gbtreekey_var_out(gbtreekey_var);
+ALTER EXTENSION btree_gist ADD function gbt_oid_consistent(internal,oid,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_oid_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_decompress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_var_decompress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_oid_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_oid_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_oid_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_oid_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_oid_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_oid_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_int2_consistent(internal,smallint,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int2_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_int2_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int2_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int2_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int2_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_int2_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_int2_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_int4_consistent(internal,integer,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int4_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_int4_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int4_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int4_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int4_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_int4_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_int4_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_int8_consistent(internal,bigint,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int8_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_int8_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int8_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int8_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_int8_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_int8_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_int8_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_float4_consistent(internal,real,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_float4_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_float4_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_float4_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_float4_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_float4_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_float4_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_float4_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_float8_consistent(internal,double precision,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_float8_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_float8_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_float8_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_float8_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_float8_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_float8_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_float8_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_ts_consistent(internal,timestamp without time zone,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_tstz_consistent(internal,timestamp with time zone,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_ts_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_tstz_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_ts_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_ts_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_ts_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_ts_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_timestamp_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_timestamp_ops using gist;
+ALTER EXTENSION btree_gist ADD operator family gist_timestamptz_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_timestamptz_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_time_consistent(internal,time without time zone,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_timetz_consistent(internal,time with time zone,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_time_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_timetz_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_time_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_time_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_time_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_time_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_time_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_time_ops using gist;
+ALTER EXTENSION btree_gist ADD operator family gist_timetz_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_timetz_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_date_consistent(internal,date,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_date_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_date_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_date_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_date_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_date_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_date_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_date_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_intv_consistent(internal,interval,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_intv_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_intv_decompress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_intv_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_intv_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_intv_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_intv_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_interval_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_interval_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_cash_consistent(internal,money,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_cash_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_cash_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_cash_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_cash_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_cash_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_cash_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_cash_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_macad_consistent(internal,macaddr,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_macad_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_macad_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_macad_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_macad_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_macad_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_macaddr_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_macaddr_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_text_consistent(internal,text,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_bpchar_consistent(internal,character,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_text_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_bpchar_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_text_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_text_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_text_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_text_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_text_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_text_ops using gist;
+ALTER EXTENSION btree_gist ADD operator family gist_bpchar_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_bpchar_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_bytea_consistent(internal,bytea,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_bytea_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_bytea_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_bytea_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_bytea_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_bytea_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_bytea_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_bytea_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_numeric_consistent(internal,numeric,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_numeric_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_numeric_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_numeric_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_numeric_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_numeric_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_numeric_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_numeric_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_bit_consistent(internal,bit,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_bit_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_bit_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_bit_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_bit_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_bit_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_bit_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_bit_ops using gist;
+ALTER EXTENSION btree_gist ADD operator family gist_vbit_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_vbit_ops using gist;
+ALTER EXTENSION btree_gist ADD function gbt_inet_consistent(internal,inet,smallint,oid,internal);
+ALTER EXTENSION btree_gist ADD function gbt_inet_compress(internal);
+ALTER EXTENSION btree_gist ADD function gbt_inet_penalty(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_inet_picksplit(internal,internal);
+ALTER EXTENSION btree_gist ADD function gbt_inet_union(bytea,internal);
+ALTER EXTENSION btree_gist ADD function gbt_inet_same(internal,internal,internal);
+ALTER EXTENSION btree_gist ADD operator family gist_inet_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_inet_ops using gist;
+ALTER EXTENSION btree_gist ADD operator family gist_cidr_ops using gist;
+ALTER EXTENSION btree_gist ADD operator class gist_cidr_ops using gist;
diff --git a/contrib/btree_gist/btree_gist.control b/contrib/btree_gist/btree_gist.control
new file mode 100644
index 0000000000..10e2f949c1
--- /dev/null
+++ b/contrib/btree_gist/btree_gist.control
@@ -0,0 +1,5 @@
+# btree_gist extension
+comment = 'support for indexing common datatypes in GiST'
+default_version = '1.0'
+module_pathname = '$libdir/btree_gist'
+relocatable = true
diff --git a/contrib/btree_gist/expected/init.out b/contrib/btree_gist/expected/init.out
index c808249545..afe0534682 100644
--- a/contrib/btree_gist/expected/init.out
+++ b/contrib/btree_gist/expected/init.out
@@ -1,7 +1 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of btree_gist.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION btree_gist;
diff --git a/contrib/btree_gist/sql/init.sql b/contrib/btree_gist/sql/init.sql
index 7fafde12d8..afe0534682 100644
--- a/contrib/btree_gist/sql/init.sql
+++ b/contrib/btree_gist/sql/init.sql
@@ -1,9 +1 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of btree_gist.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i btree_gist.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION btree_gist;
diff --git a/contrib/btree_gist/uninstall_btree_gist.sql b/contrib/btree_gist/uninstall_btree_gist.sql
deleted file mode 100644
index 30b9da4c73..0000000000
--- a/contrib/btree_gist/uninstall_btree_gist.sql
+++ /dev/null
@@ -1,280 +0,0 @@
-/* contrib/btree_gist/uninstall_btree_gist.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP OPERATOR CLASS gist_cidr_ops USING gist;
-
-DROP OPERATOR CLASS gist_inet_ops USING gist;
-
-DROP FUNCTION gbt_inet_same(internal, internal, internal);
-
-DROP FUNCTION gbt_inet_union(bytea, internal);
-
-DROP FUNCTION gbt_inet_picksplit(internal, internal);
-
-DROP FUNCTION gbt_inet_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_inet_compress(internal);
-
-DROP FUNCTION gbt_inet_consistent(internal,inet,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_vbit_ops USING gist;
-
-DROP OPERATOR CLASS gist_bit_ops USING gist;
-
-DROP FUNCTION gbt_bit_same(internal, internal, internal);
-
-DROP FUNCTION gbt_bit_union(bytea, internal);
-
-DROP FUNCTION gbt_bit_picksplit(internal, internal);
-
-DROP FUNCTION gbt_bit_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_bit_compress(internal);
-
-DROP FUNCTION gbt_bit_consistent(internal,bit,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_numeric_ops USING gist;
-
-DROP FUNCTION gbt_numeric_same(internal, internal, internal);
-
-DROP FUNCTION gbt_numeric_union(bytea, internal);
-
-DROP FUNCTION gbt_numeric_picksplit(internal, internal);
-
-DROP FUNCTION gbt_numeric_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_numeric_compress(internal);
-
-DROP FUNCTION gbt_numeric_consistent(internal,numeric,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_bytea_ops USING gist;
-
-DROP FUNCTION gbt_bytea_same(internal, internal, internal);
-
-DROP FUNCTION gbt_bytea_union(bytea, internal);
-
-DROP FUNCTION gbt_bytea_picksplit(internal, internal);
-
-DROP FUNCTION gbt_bytea_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_bytea_compress(internal);
-
-DROP FUNCTION gbt_bytea_consistent(internal,bytea,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_bpchar_ops USING gist;
-
-DROP OPERATOR CLASS gist_text_ops USING gist;
-
-DROP FUNCTION gbt_text_same(internal, internal, internal);
-
-DROP FUNCTION gbt_text_union(bytea, internal);
-
-DROP FUNCTION gbt_text_picksplit(internal, internal);
-
-DROP FUNCTION gbt_text_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_bpchar_compress(internal);
-
-DROP FUNCTION gbt_text_compress(internal);
-
-DROP FUNCTION gbt_bpchar_consistent(internal,bpchar,int2,oid,internal);
-
-DROP FUNCTION gbt_text_consistent(internal,text,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_macaddr_ops USING gist;
-
-DROP FUNCTION gbt_macad_same(internal, internal, internal);
-
-DROP FUNCTION gbt_macad_union(bytea, internal);
-
-DROP FUNCTION gbt_macad_picksplit(internal, internal);
-
-DROP FUNCTION gbt_macad_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_macad_compress(internal);
-
-DROP FUNCTION gbt_macad_consistent(internal,macaddr,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_cash_ops USING gist;
-
-DROP FUNCTION gbt_cash_same(internal, internal, internal);
-
-DROP FUNCTION gbt_cash_union(bytea, internal);
-
-DROP FUNCTION gbt_cash_picksplit(internal, internal);
-
-DROP FUNCTION gbt_cash_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_cash_compress(internal);
-
-DROP FUNCTION gbt_cash_consistent(internal,money,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_interval_ops USING gist;
-
-DROP FUNCTION gbt_intv_same(internal, internal, internal);
-
-DROP FUNCTION gbt_intv_union(bytea, internal);
-
-DROP FUNCTION gbt_intv_picksplit(internal, internal);
-
-DROP FUNCTION gbt_intv_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_intv_decompress(internal);
-
-DROP FUNCTION gbt_intv_compress(internal);
-
-DROP FUNCTION gbt_intv_consistent(internal,interval,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_date_ops USING gist;
-
-DROP FUNCTION gbt_date_same(internal, internal, internal);
-
-DROP FUNCTION gbt_date_union(bytea, internal);
-
-DROP FUNCTION gbt_date_picksplit(internal, internal);
-
-DROP FUNCTION gbt_date_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_date_compress(internal);
-
-DROP FUNCTION gbt_date_consistent(internal,date,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_timetz_ops USING gist;
-
-DROP OPERATOR CLASS gist_time_ops USING gist;
-
-DROP FUNCTION gbt_time_same(internal, internal, internal);
-
-DROP FUNCTION gbt_time_union(bytea, internal);
-
-DROP FUNCTION gbt_time_picksplit(internal, internal);
-
-DROP FUNCTION gbt_time_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_timetz_compress(internal);
-
-DROP FUNCTION gbt_time_compress(internal);
-
-DROP FUNCTION gbt_timetz_consistent(internal,timetz,int2,oid,internal);
-
-DROP FUNCTION gbt_time_consistent(internal,time,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_timestamptz_ops USING gist;
-
-DROP OPERATOR CLASS gist_timestamp_ops USING gist;
-
-DROP FUNCTION gbt_ts_same(internal, internal, internal);
-
-DROP FUNCTION gbt_ts_union(bytea, internal);
-
-DROP FUNCTION gbt_ts_picksplit(internal, internal);
-
-DROP FUNCTION gbt_ts_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_tstz_compress(internal);
-
-DROP FUNCTION gbt_ts_compress(internal);
-
-DROP FUNCTION gbt_tstz_consistent(internal,timestamptz,int2,oid,internal);
-
-DROP FUNCTION gbt_ts_consistent(internal,timestamp,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_float8_ops USING gist;
-
-DROP FUNCTION gbt_float8_same(internal, internal, internal);
-
-DROP FUNCTION gbt_float8_union(bytea, internal);
-
-DROP FUNCTION gbt_float8_picksplit(internal, internal);
-
-DROP FUNCTION gbt_float8_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_float8_compress(internal);
-
-DROP FUNCTION gbt_float8_consistent(internal,float8,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_float4_ops USING gist;
-
-DROP FUNCTION gbt_float4_same(internal, internal, internal);
-
-DROP FUNCTION gbt_float4_union(bytea, internal);
-
-DROP FUNCTION gbt_float4_picksplit(internal, internal);
-
-DROP FUNCTION gbt_float4_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_float4_compress(internal);
-
-DROP FUNCTION gbt_float4_consistent(internal,float4,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_int8_ops USING gist;
-
-DROP FUNCTION gbt_int8_same(internal, internal, internal);
-
-DROP FUNCTION gbt_int8_union(bytea, internal);
-
-DROP FUNCTION gbt_int8_picksplit(internal, internal);
-
-DROP FUNCTION gbt_int8_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_int8_compress(internal);
-
-DROP FUNCTION gbt_int8_consistent(internal,int8,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_int4_ops USING gist;
-
-DROP FUNCTION gbt_int4_same(internal, internal, internal);
-
-DROP FUNCTION gbt_int4_union(bytea, internal);
-
-DROP FUNCTION gbt_int4_picksplit(internal, internal);
-
-DROP FUNCTION gbt_int4_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_int4_compress(internal);
-
-DROP FUNCTION gbt_int4_consistent(internal,int4,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_int2_ops USING gist;
-
-DROP FUNCTION gbt_int2_same(internal, internal, internal);
-
-DROP FUNCTION gbt_int2_union(bytea, internal);
-
-DROP FUNCTION gbt_int2_picksplit(internal, internal);
-
-DROP FUNCTION gbt_int2_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_int2_compress(internal);
-
-DROP FUNCTION gbt_int2_consistent(internal,int2,int2,oid,internal);
-
-DROP OPERATOR CLASS gist_oid_ops USING gist;
-
-DROP FUNCTION gbt_oid_same(internal, internal, internal);
-
-DROP FUNCTION gbt_oid_union(bytea, internal);
-
-DROP FUNCTION gbt_oid_picksplit(internal, internal);
-
-DROP FUNCTION gbt_oid_penalty(internal,internal,internal);
-
-DROP FUNCTION gbt_var_decompress(internal);
-
-DROP FUNCTION gbt_decompress(internal);
-
-DROP FUNCTION gbt_oid_compress(internal);
-
-DROP FUNCTION gbt_oid_consistent(internal,oid,int2,oid,internal);
-
-DROP TYPE gbtreekey_var CASCADE;
-
-DROP TYPE gbtreekey32 CASCADE;
-
-DROP TYPE gbtreekey16 CASCADE;
-
-DROP TYPE gbtreekey8 CASCADE;
-
-DROP TYPE gbtreekey4 CASCADE;
diff --git a/contrib/chkpass/.gitignore b/contrib/chkpass/.gitignore
deleted file mode 100644
index 9029d666aa..0000000000
--- a/contrib/chkpass/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/chkpass.sql
diff --git a/contrib/chkpass/Makefile b/contrib/chkpass/Makefile
index 3677dfcb56..b775aef17d 100644
--- a/contrib/chkpass/Makefile
+++ b/contrib/chkpass/Makefile
@@ -2,9 +2,11 @@
MODULE_big = chkpass
OBJS = chkpass.o
+
+EXTENSION = chkpass
+DATA = chkpass--1.0.sql chkpass--unpackaged--1.0.sql
+
SHLIB_LINK = $(filter -lcrypt, $(LIBS))
-DATA_built = chkpass.sql
-DATA = uninstall_chkpass.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/chkpass/chkpass.sql.in b/contrib/chkpass/chkpass--1.0.sql
index 3cec0224b0..aad74683f7 100644
--- a/contrib/chkpass/chkpass.sql.in
+++ b/contrib/chkpass/chkpass--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/chkpass/chkpass.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/chkpass/chkpass--1.0.sql */
--
-- Input and output functions and the type itself:
diff --git a/contrib/chkpass/chkpass--unpackaged--1.0.sql b/contrib/chkpass/chkpass--unpackaged--1.0.sql
new file mode 100644
index 0000000000..bf91950f3c
--- /dev/null
+++ b/contrib/chkpass/chkpass--unpackaged--1.0.sql
@@ -0,0 +1,10 @@
+/* contrib/chkpass/chkpass--unpackaged--1.0.sql */
+
+ALTER EXTENSION chkpass ADD type chkpass;
+ALTER EXTENSION chkpass ADD function chkpass_in(cstring);
+ALTER EXTENSION chkpass ADD function chkpass_out(chkpass);
+ALTER EXTENSION chkpass ADD function raw(chkpass);
+ALTER EXTENSION chkpass ADD function eq(chkpass,text);
+ALTER EXTENSION chkpass ADD function ne(chkpass,text);
+ALTER EXTENSION chkpass ADD operator <>(chkpass,text);
+ALTER EXTENSION chkpass ADD operator =(chkpass,text);
diff --git a/contrib/chkpass/chkpass.control b/contrib/chkpass/chkpass.control
new file mode 100644
index 0000000000..bd4b3d3d0d
--- /dev/null
+++ b/contrib/chkpass/chkpass.control
@@ -0,0 +1,5 @@
+# chkpass extension
+comment = 'data type for auto-encrypted passwords'
+default_version = '1.0'
+module_pathname = '$libdir/chkpass'
+relocatable = true
diff --git a/contrib/chkpass/uninstall_chkpass.sql b/contrib/chkpass/uninstall_chkpass.sql
deleted file mode 100644
index 93ab6eb4eb..0000000000
--- a/contrib/chkpass/uninstall_chkpass.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-/* contrib/chkpass/uninstall_chkpass.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP OPERATOR <>(chkpass, text);
-
-DROP OPERATOR =(chkpass, text);
-
-DROP FUNCTION ne(chkpass, text);
-
-DROP FUNCTION eq(chkpass, text);
-
-DROP FUNCTION raw(chkpass);
-
-DROP TYPE chkpass CASCADE;
diff --git a/contrib/citext/.gitignore b/contrib/citext/.gitignore
index e626817156..19b6c5ba42 100644
--- a/contrib/citext/.gitignore
+++ b/contrib/citext/.gitignore
@@ -1,3 +1,2 @@
-/citext.sql
# Generated subdirectories
/results/
diff --git a/contrib/citext/Makefile b/contrib/citext/Makefile
index c868eca884..65942528dd 100644
--- a/contrib/citext/Makefile
+++ b/contrib/citext/Makefile
@@ -1,8 +1,10 @@
# contrib/citext/Makefile
MODULES = citext
-DATA_built = citext.sql
-DATA = uninstall_citext.sql
+
+EXTENSION = citext
+DATA = citext--1.0.sql citext--unpackaged--1.0.sql
+
REGRESS = citext
ifdef USE_PGXS
diff --git a/contrib/citext/citext.sql.in b/contrib/citext/citext--1.0.sql
index 7056d0ead3..13cff8134a 100644
--- a/contrib/citext/citext.sql.in
+++ b/contrib/citext/citext--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/citext/citext.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/citext/citext--1.0.sql */
--
-- PostgreSQL code for CITEXT.
diff --git a/contrib/citext/citext--unpackaged--1.0.sql b/contrib/citext/citext--unpackaged--1.0.sql
new file mode 100644
index 0000000000..7dcdc39413
--- /dev/null
+++ b/contrib/citext/citext--unpackaged--1.0.sql
@@ -0,0 +1,76 @@
+/* contrib/citext/citext--unpackaged--1.0.sql */
+
+ALTER EXTENSION citext ADD type citext;
+ALTER EXTENSION citext ADD function citextin(cstring);
+ALTER EXTENSION citext ADD function citextout(citext);
+ALTER EXTENSION citext ADD function citextrecv(internal);
+ALTER EXTENSION citext ADD function citextsend(citext);
+ALTER EXTENSION citext ADD function citext(character);
+ALTER EXTENSION citext ADD function citext(boolean);
+ALTER EXTENSION citext ADD function citext(inet);
+ALTER EXTENSION citext ADD cast (citext as text);
+ALTER EXTENSION citext ADD cast (citext as character varying);
+ALTER EXTENSION citext ADD cast (citext as character);
+ALTER EXTENSION citext ADD cast (text as citext);
+ALTER EXTENSION citext ADD cast (character varying as citext);
+ALTER EXTENSION citext ADD cast (character as citext);
+ALTER EXTENSION citext ADD cast (boolean as citext);
+ALTER EXTENSION citext ADD cast (inet as citext);
+ALTER EXTENSION citext ADD function citext_eq(citext,citext);
+ALTER EXTENSION citext ADD function citext_ne(citext,citext);
+ALTER EXTENSION citext ADD function citext_lt(citext,citext);
+ALTER EXTENSION citext ADD function citext_le(citext,citext);
+ALTER EXTENSION citext ADD function citext_gt(citext,citext);
+ALTER EXTENSION citext ADD function citext_ge(citext,citext);
+ALTER EXTENSION citext ADD operator <>(citext,citext);
+ALTER EXTENSION citext ADD operator =(citext,citext);
+ALTER EXTENSION citext ADD operator >(citext,citext);
+ALTER EXTENSION citext ADD operator >=(citext,citext);
+ALTER EXTENSION citext ADD operator <(citext,citext);
+ALTER EXTENSION citext ADD operator <=(citext,citext);
+ALTER EXTENSION citext ADD function citext_cmp(citext,citext);
+ALTER EXTENSION citext ADD function citext_hash(citext);
+ALTER EXTENSION citext ADD operator family citext_ops using btree;
+ALTER EXTENSION citext ADD operator class citext_ops using btree;
+ALTER EXTENSION citext ADD operator family citext_ops using hash;
+ALTER EXTENSION citext ADD operator class citext_ops using hash;
+ALTER EXTENSION citext ADD function citext_smaller(citext,citext);
+ALTER EXTENSION citext ADD function citext_larger(citext,citext);
+ALTER EXTENSION citext ADD function min(citext);
+ALTER EXTENSION citext ADD function max(citext);
+ALTER EXTENSION citext ADD function texticlike(citext,citext);
+ALTER EXTENSION citext ADD function texticnlike(citext,citext);
+ALTER EXTENSION citext ADD function texticregexeq(citext,citext);
+ALTER EXTENSION citext ADD function texticregexne(citext,citext);
+ALTER EXTENSION citext ADD operator !~(citext,citext);
+ALTER EXTENSION citext ADD operator ~(citext,citext);
+ALTER EXTENSION citext ADD operator !~*(citext,citext);
+ALTER EXTENSION citext ADD operator ~*(citext,citext);
+ALTER EXTENSION citext ADD operator !~~(citext,citext);
+ALTER EXTENSION citext ADD operator ~~(citext,citext);
+ALTER EXTENSION citext ADD operator !~~*(citext,citext);
+ALTER EXTENSION citext ADD operator ~~*(citext,citext);
+ALTER EXTENSION citext ADD function texticlike(citext,text);
+ALTER EXTENSION citext ADD function texticnlike(citext,text);
+ALTER EXTENSION citext ADD function texticregexeq(citext,text);
+ALTER EXTENSION citext ADD function texticregexne(citext,text);
+ALTER EXTENSION citext ADD operator !~(citext,text);
+ALTER EXTENSION citext ADD operator ~(citext,text);
+ALTER EXTENSION citext ADD operator !~*(citext,text);
+ALTER EXTENSION citext ADD operator ~*(citext,text);
+ALTER EXTENSION citext ADD operator !~~(citext,text);
+ALTER EXTENSION citext ADD operator ~~(citext,text);
+ALTER EXTENSION citext ADD operator !~~*(citext,text);
+ALTER EXTENSION citext ADD operator ~~*(citext,text);
+ALTER EXTENSION citext ADD function regexp_matches(citext,citext);
+ALTER EXTENSION citext ADD function regexp_matches(citext,citext,text);
+ALTER EXTENSION citext ADD function regexp_replace(citext,citext,text);
+ALTER EXTENSION citext ADD function regexp_replace(citext,citext,text,text);
+ALTER EXTENSION citext ADD function regexp_split_to_array(citext,citext);
+ALTER EXTENSION citext ADD function regexp_split_to_array(citext,citext,text);
+ALTER EXTENSION citext ADD function regexp_split_to_table(citext,citext);
+ALTER EXTENSION citext ADD function regexp_split_to_table(citext,citext,text);
+ALTER EXTENSION citext ADD function strpos(citext,citext);
+ALTER EXTENSION citext ADD function replace(citext,citext,citext);
+ALTER EXTENSION citext ADD function split_part(citext,citext,integer);
+ALTER EXTENSION citext ADD function translate(citext,citext,text);
diff --git a/contrib/citext/citext.control b/contrib/citext/citext.control
new file mode 100644
index 0000000000..3eb01a3360
--- /dev/null
+++ b/contrib/citext/citext.control
@@ -0,0 +1,5 @@
+# citext extension
+comment = 'data type for case-insensitive character strings'
+default_version = '1.0'
+module_pathname = '$libdir/citext'
+relocatable = true
diff --git a/contrib/citext/expected/citext.out b/contrib/citext/expected/citext.out
index 66ea5ee6ff..5392a7d1f3 100644
--- a/contrib/citext/expected/citext.out
+++ b/contrib/citext/expected/citext.out
@@ -1,12 +1,7 @@
--
-- Test citext datatype
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of citext.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
+CREATE EXTENSION citext;
-- Test the operators and indexing functions
-- Test = and <>.
SELECT 'a'::citext = 'a'::citext AS t;
diff --git a/contrib/citext/expected/citext_1.out b/contrib/citext/expected/citext_1.out
index c5ca1f6c54..5316ad0cda 100644
--- a/contrib/citext/expected/citext_1.out
+++ b/contrib/citext/expected/citext_1.out
@@ -1,12 +1,7 @@
--
-- Test citext datatype
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of citext.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
+CREATE EXTENSION citext;
-- Test the operators and indexing functions
-- Test = and <>.
SELECT 'a'::citext = 'a'::citext AS t;
diff --git a/contrib/citext/sql/citext.sql b/contrib/citext/sql/citext.sql
index 2f9b46665c..07497401a4 100644
--- a/contrib/citext/sql/citext.sql
+++ b/contrib/citext/sql/citext.sql
@@ -2,15 +2,7 @@
-- Test citext datatype
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of citext.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i citext.sql
-RESET client_min_messages;
-\set ECHO all
+CREATE EXTENSION citext;
-- Test the operators and indexing functions
diff --git a/contrib/citext/uninstall_citext.sql b/contrib/citext/uninstall_citext.sql
deleted file mode 100644
index 468987ad82..0000000000
--- a/contrib/citext/uninstall_citext.sql
+++ /dev/null
@@ -1,80 +0,0 @@
-/* contrib/citext/uninstall_citext.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP OPERATOR CLASS citext_ops USING btree CASCADE;
-DROP OPERATOR CLASS citext_ops USING hash CASCADE;
-
-DROP AGGREGATE min(citext);
-DROP AGGREGATE max(citext);
-
-DROP OPERATOR = (citext, citext);
-DROP OPERATOR <> (citext, citext);
-DROP OPERATOR < (citext, citext);
-DROP OPERATOR <= (citext, citext);
-DROP OPERATOR >= (citext, citext);
-DROP OPERATOR > (citext, citext);
-
-DROP OPERATOR ~ (citext, citext);
-DROP OPERATOR ~* (citext, citext);
-DROP OPERATOR !~ (citext, citext);
-DROP OPERATOR !~* (citext, citext);
-DROP OPERATOR ~~ (citext, citext);
-DROP OPERATOR ~~* (citext, citext);
-DROP OPERATOR !~~ (citext, citext);
-DROP OPERATOR !~~* (citext, citext);
-
-DROP OPERATOR ~ (citext, text);
-DROP OPERATOR ~* (citext, text);
-DROP OPERATOR !~ (citext, text);
-DROP OPERATOR !~* (citext, text);
-DROP OPERATOR ~~ (citext, text);
-DROP OPERATOR ~~* (citext, text);
-DROP OPERATOR !~~ (citext, text);
-DROP OPERATOR !~~* (citext, text);
-
-DROP CAST (citext AS text);
-DROP CAST (citext AS varchar);
-DROP CAST (citext AS bpchar);
-DROP CAST (text AS citext);
-DROP CAST (varchar AS citext);
-DROP CAST (bpchar AS citext);
-DROP CAST (boolean AS citext);
-DROP CAST (inet AS citext);
-
-DROP FUNCTION citext(bpchar);
-DROP FUNCTION citext(boolean);
-DROP FUNCTION citext(inet);
-DROP FUNCTION citext_eq(citext, citext);
-DROP FUNCTION citext_ne(citext, citext);
-DROP FUNCTION citext_lt(citext, citext);
-DROP FUNCTION citext_le(citext, citext);
-DROP FUNCTION citext_gt(citext, citext);
-DROP FUNCTION citext_ge(citext, citext);
-DROP FUNCTION citext_cmp(citext, citext);
-DROP FUNCTION citext_hash(citext);
-DROP FUNCTION citext_smaller(citext, citext);
-DROP FUNCTION citext_larger(citext, citext);
-DROP FUNCTION texticlike(citext, citext);
-DROP FUNCTION texticnlike(citext, citext);
-DROP FUNCTION texticregexeq(citext, citext);
-DROP FUNCTION texticregexne(citext, citext);
-DROP FUNCTION texticlike(citext, text);
-DROP FUNCTION texticnlike(citext, text);
-DROP FUNCTION texticregexeq(citext, text);
-DROP FUNCTION texticregexne(citext, text);
-DROP FUNCTION regexp_matches( citext, citext );
-DROP FUNCTION regexp_matches( citext, citext, text );
-DROP FUNCTION regexp_replace( citext, citext, text );
-DROP FUNCTION regexp_replace( citext, citext, text, text );
-DROP FUNCTION regexp_split_to_array( citext, citext );
-DROP FUNCTION regexp_split_to_array( citext, citext, text );
-DROP FUNCTION regexp_split_to_table( citext, citext );
-DROP FUNCTION regexp_split_to_table( citext, citext, text );
-DROP FUNCTION strpos( citext, citext );
-DROP FUNCTION replace( citext, citext, citext );
-DROP FUNCTION split_part( citext, citext, int );
-DROP FUNCTION translate( citext, citext, text );
-
-DROP TYPE citext CASCADE;
diff --git a/contrib/cube/.gitignore b/contrib/cube/.gitignore
index 9f60da5078..a6484a05e7 100644
--- a/contrib/cube/.gitignore
+++ b/contrib/cube/.gitignore
@@ -1,5 +1,4 @@
/cubeparse.c
/cubescan.c
-/cube.sql
# Generated subdirectories
/results/
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 4fee79f84e..19fd7dc658 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -3,8 +3,9 @@
MODULE_big = cube
OBJS= cube.o cubeparse.o
-DATA_built = cube.sql
-DATA = uninstall_cube.sql
+EXTENSION = cube
+DATA = cube--1.0.sql cube--unpackaged--1.0.sql
+
REGRESS = cube
EXTRA_CLEAN = y.tab.c y.tab.h
diff --git a/contrib/cube/cube.sql.in b/contrib/cube/cube--1.0.sql
index a7e6b1d2b9..18d69a5488 100644
--- a/contrib/cube/cube.sql.in
+++ b/contrib/cube/cube--1.0.sql
@@ -1,10 +1,6 @@
-/* contrib/cube/cube.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/cube/cube--1.0.sql */
-- Create the user-defined type for N-dimensional boxes
---
CREATE OR REPLACE FUNCTION cube_in(cstring)
RETURNS cube
diff --git a/contrib/cube/cube--unpackaged--1.0.sql b/contrib/cube/cube--unpackaged--1.0.sql
new file mode 100644
index 0000000000..866c18a289
--- /dev/null
+++ b/contrib/cube/cube--unpackaged--1.0.sql
@@ -0,0 +1,53 @@
+/* contrib/cube/cube--unpackaged--1.0.sql */
+
+ALTER EXTENSION cube ADD type cube;
+ALTER EXTENSION cube ADD function cube_in(cstring);
+ALTER EXTENSION cube ADD function cube(double precision[],double precision[]);
+ALTER EXTENSION cube ADD function cube(double precision[]);
+ALTER EXTENSION cube ADD function cube_out(cube);
+ALTER EXTENSION cube ADD function cube_eq(cube,cube);
+ALTER EXTENSION cube ADD function cube_ne(cube,cube);
+ALTER EXTENSION cube ADD function cube_lt(cube,cube);
+ALTER EXTENSION cube ADD function cube_gt(cube,cube);
+ALTER EXTENSION cube ADD function cube_le(cube,cube);
+ALTER EXTENSION cube ADD function cube_ge(cube,cube);
+ALTER EXTENSION cube ADD function cube_cmp(cube,cube);
+ALTER EXTENSION cube ADD function cube_contains(cube,cube);
+ALTER EXTENSION cube ADD function cube_contained(cube,cube);
+ALTER EXTENSION cube ADD function cube_overlap(cube,cube);
+ALTER EXTENSION cube ADD function cube_union(cube,cube);
+ALTER EXTENSION cube ADD function cube_inter(cube,cube);
+ALTER EXTENSION cube ADD function cube_size(cube);
+ALTER EXTENSION cube ADD function cube_subset(cube,integer[]);
+ALTER EXTENSION cube ADD function cube_distance(cube,cube);
+ALTER EXTENSION cube ADD function cube_dim(cube);
+ALTER EXTENSION cube ADD function cube_ll_coord(cube,integer);
+ALTER EXTENSION cube ADD function cube_ur_coord(cube,integer);
+ALTER EXTENSION cube ADD function cube(double precision);
+ALTER EXTENSION cube ADD function cube(double precision,double precision);
+ALTER EXTENSION cube ADD function cube(cube,double precision);
+ALTER EXTENSION cube ADD function cube(cube,double precision,double precision);
+ALTER EXTENSION cube ADD function cube_is_point(cube);
+ALTER EXTENSION cube ADD function cube_enlarge(cube,double precision,integer);
+ALTER EXTENSION cube ADD operator >(cube,cube);
+ALTER EXTENSION cube ADD operator >=(cube,cube);
+ALTER EXTENSION cube ADD operator <(cube,cube);
+ALTER EXTENSION cube ADD operator <=(cube,cube);
+ALTER EXTENSION cube ADD operator &&(cube,cube);
+ALTER EXTENSION cube ADD operator <>(cube,cube);
+ALTER EXTENSION cube ADD operator =(cube,cube);
+ALTER EXTENSION cube ADD operator <@(cube,cube);
+ALTER EXTENSION cube ADD operator @>(cube,cube);
+ALTER EXTENSION cube ADD operator ~(cube,cube);
+ALTER EXTENSION cube ADD operator @(cube,cube);
+ALTER EXTENSION cube ADD function g_cube_consistent(internal,cube,integer,oid,internal);
+ALTER EXTENSION cube ADD function g_cube_compress(internal);
+ALTER EXTENSION cube ADD function g_cube_decompress(internal);
+ALTER EXTENSION cube ADD function g_cube_penalty(internal,internal,internal);
+ALTER EXTENSION cube ADD function g_cube_picksplit(internal,internal);
+ALTER EXTENSION cube ADD function g_cube_union(internal,internal);
+ALTER EXTENSION cube ADD function g_cube_same(cube,cube,internal);
+ALTER EXTENSION cube ADD operator family cube_ops using btree;
+ALTER EXTENSION cube ADD operator class cube_ops using btree;
+ALTER EXTENSION cube ADD operator family gist_cube_ops using gist;
+ALTER EXTENSION cube ADD operator class gist_cube_ops using gist;
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
new file mode 100644
index 0000000000..ddc8d2e5d1
--- /dev/null
+++ b/contrib/cube/cube.control
@@ -0,0 +1,5 @@
+# cube extension
+comment = 'data type for multidimensional cubes'
+default_version = '1.0'
+module_pathname = '$libdir/cube'
+relocatable = true
diff --git a/contrib/cube/expected/cube.out b/contrib/cube/expected/cube.out
index ae7b5b22c2..05cf3eae3c 100644
--- a/contrib/cube/expected/cube.out
+++ b/contrib/cube/expected/cube.out
@@ -1,13 +1,7 @@
--
-- Test cube datatype
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of cube.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION cube;
--
-- testing the input and output functions
--
diff --git a/contrib/cube/expected/cube_1.out b/contrib/cube/expected/cube_1.out
index f27e832d63..fefebf5fb9 100644
--- a/contrib/cube/expected/cube_1.out
+++ b/contrib/cube/expected/cube_1.out
@@ -1,13 +1,7 @@
--
-- Test cube datatype
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of cube.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION cube;
--
-- testing the input and output functions
--
diff --git a/contrib/cube/expected/cube_2.out b/contrib/cube/expected/cube_2.out
index f534ccf0b5..6d15d63570 100644
--- a/contrib/cube/expected/cube_2.out
+++ b/contrib/cube/expected/cube_2.out
@@ -1,13 +1,7 @@
--
-- Test cube datatype
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of cube.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION cube;
--
-- testing the input and output functions
--
diff --git a/contrib/cube/sql/cube.sql b/contrib/cube/sql/cube.sql
index 5c12183dfd..02e068edf4 100644
--- a/contrib/cube/sql/cube.sql
+++ b/contrib/cube/sql/cube.sql
@@ -2,15 +2,7 @@
-- Test cube datatype
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of cube.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i cube.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION cube;
--
-- testing the input and output functions
diff --git a/contrib/cube/uninstall_cube.sql b/contrib/cube/uninstall_cube.sql
deleted file mode 100644
index aa7119e0d0..0000000000
--- a/contrib/cube/uninstall_cube.sql
+++ /dev/null
@@ -1,98 +0,0 @@
-/* contrib/cube/uninstall_cube.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP OPERATOR CLASS gist_cube_ops USING gist;
-
-DROP OPERATOR CLASS cube_ops USING btree;
-
-DROP FUNCTION g_cube_same(cube, cube, internal);
-
-DROP FUNCTION g_cube_union(internal, internal);
-
-DROP FUNCTION g_cube_picksplit(internal, internal);
-
-DROP FUNCTION g_cube_penalty(internal,internal,internal);
-
-DROP FUNCTION g_cube_decompress(internal);
-
-DROP FUNCTION g_cube_compress(internal);
-
-DROP FUNCTION g_cube_consistent(internal,cube,int,oid,internal);
-
-DROP OPERATOR ~ (cube, cube);
-
-DROP OPERATOR @ (cube, cube);
-
-DROP OPERATOR <@ (cube, cube);
-
-DROP OPERATOR @> (cube, cube);
-
-DROP OPERATOR <> (cube, cube);
-
-DROP OPERATOR = (cube, cube);
-
-DROP OPERATOR && (cube, cube);
-
-DROP OPERATOR >= (cube, cube);
-
-DROP OPERATOR <= (cube, cube);
-
-DROP OPERATOR > (cube, cube);
-
-DROP OPERATOR < (cube, cube);
-
-DROP FUNCTION cube_enlarge(cube, float8, int4);
-
-DROP FUNCTION cube_is_point(cube);
-
-DROP FUNCTION cube(cube, float8, float8);
-
-DROP FUNCTION cube(cube, float8);
-
-DROP FUNCTION cube(float8, float8);
-
-DROP FUNCTION cube(float8[], float8[]);
-
-DROP FUNCTION cube(float8[]);
-
-DROP FUNCTION cube_subset(cube, int4[]);
-
-DROP FUNCTION cube(float8);
-
-DROP FUNCTION cube_ur_coord(cube, int4);
-
-DROP FUNCTION cube_ll_coord(cube, int4);
-
-DROP FUNCTION cube_dim(cube);
-
-DROP FUNCTION cube_distance(cube, cube);
-
-DROP FUNCTION cube_size(cube);
-
-DROP FUNCTION cube_inter(cube, cube);
-
-DROP FUNCTION cube_union(cube, cube);
-
-DROP FUNCTION cube_overlap(cube, cube);
-
-DROP FUNCTION cube_contained(cube, cube);
-
-DROP FUNCTION cube_contains(cube, cube);
-
-DROP FUNCTION cube_cmp(cube, cube);
-
-DROP FUNCTION cube_ge(cube, cube);
-
-DROP FUNCTION cube_le(cube, cube);
-
-DROP FUNCTION cube_gt(cube, cube);
-
-DROP FUNCTION cube_lt(cube, cube);
-
-DROP FUNCTION cube_ne(cube, cube);
-
-DROP FUNCTION cube_eq(cube, cube);
-
-DROP TYPE cube CASCADE;
diff --git a/contrib/dblink/.gitignore b/contrib/dblink/.gitignore
index fb7e8728bc..19b6c5ba42 100644
--- a/contrib/dblink/.gitignore
+++ b/contrib/dblink/.gitignore
@@ -1,3 +1,2 @@
-/dblink.sql
# Generated subdirectories
/results/
diff --git a/contrib/dblink/Makefile b/contrib/dblink/Makefile
index fdfd03a4cf..ac637480eb 100644
--- a/contrib/dblink/Makefile
+++ b/contrib/dblink/Makefile
@@ -1,15 +1,15 @@
# contrib/dblink/Makefile
MODULE_big = dblink
-PG_CPPFLAGS = -I$(libpq_srcdir)
OBJS = dblink.o
+PG_CPPFLAGS = -I$(libpq_srcdir)
SHLIB_LINK = $(libpq)
SHLIB_PREREQS = submake-libpq
-DATA_built = dblink.sql
-DATA = uninstall_dblink.sql
-REGRESS = dblink
+EXTENSION = dblink
+DATA = dblink--1.0.sql dblink--unpackaged--1.0.sql
+REGRESS = dblink
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/dblink/dblink.sql.in b/contrib/dblink/dblink--1.0.sql
index 3c9d66e7df..e9137828f1 100644
--- a/contrib/dblink/dblink.sql.in
+++ b/contrib/dblink/dblink--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/dblink/dblink.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/dblink/dblink--1.0.sql */
-- dblink_connect now restricts non-superusers to password
-- authenticated connections
diff --git a/contrib/dblink/dblink--unpackaged--1.0.sql b/contrib/dblink/dblink--unpackaged--1.0.sql
new file mode 100644
index 0000000000..b6d184b4a2
--- /dev/null
+++ b/contrib/dblink/dblink--unpackaged--1.0.sql
@@ -0,0 +1,43 @@
+/* contrib/dblink/dblink--unpackaged--1.0.sql */
+
+ALTER EXTENSION dblink ADD function dblink_connect(text);
+ALTER EXTENSION dblink ADD function dblink_connect(text,text);
+ALTER EXTENSION dblink ADD function dblink_connect_u(text);
+ALTER EXTENSION dblink ADD function dblink_connect_u(text,text);
+ALTER EXTENSION dblink ADD function dblink_disconnect();
+ALTER EXTENSION dblink ADD function dblink_disconnect(text);
+ALTER EXTENSION dblink ADD function dblink_open(text,text);
+ALTER EXTENSION dblink ADD function dblink_open(text,text,boolean);
+ALTER EXTENSION dblink ADD function dblink_open(text,text,text);
+ALTER EXTENSION dblink ADD function dblink_open(text,text,text,boolean);
+ALTER EXTENSION dblink ADD function dblink_fetch(text,integer);
+ALTER EXTENSION dblink ADD function dblink_fetch(text,integer,boolean);
+ALTER EXTENSION dblink ADD function dblink_fetch(text,text,integer);
+ALTER EXTENSION dblink ADD function dblink_fetch(text,text,integer,boolean);
+ALTER EXTENSION dblink ADD function dblink_close(text);
+ALTER EXTENSION dblink ADD function dblink_close(text,boolean);
+ALTER EXTENSION dblink ADD function dblink_close(text,text);
+ALTER EXTENSION dblink ADD function dblink_close(text,text,boolean);
+ALTER EXTENSION dblink ADD function dblink(text,text);
+ALTER EXTENSION dblink ADD function dblink(text,text,boolean);
+ALTER EXTENSION dblink ADD function dblink(text);
+ALTER EXTENSION dblink ADD function dblink(text,boolean);
+ALTER EXTENSION dblink ADD function dblink_exec(text,text);
+ALTER EXTENSION dblink ADD function dblink_exec(text,text,boolean);
+ALTER EXTENSION dblink ADD function dblink_exec(text);
+ALTER EXTENSION dblink ADD function dblink_exec(text,boolean);
+ALTER EXTENSION dblink ADD type dblink_pkey_results;
+ALTER EXTENSION dblink ADD function dblink_get_pkey(text);
+ALTER EXTENSION dblink ADD function dblink_build_sql_insert(text,int2vector,integer,text[],text[]);
+ALTER EXTENSION dblink ADD function dblink_build_sql_delete(text,int2vector,integer,text[]);
+ALTER EXTENSION dblink ADD function dblink_build_sql_update(text,int2vector,integer,text[],text[]);
+ALTER EXTENSION dblink ADD function dblink_current_query();
+ALTER EXTENSION dblink ADD function dblink_send_query(text,text);
+ALTER EXTENSION dblink ADD function dblink_is_busy(text);
+ALTER EXTENSION dblink ADD function dblink_get_result(text);
+ALTER EXTENSION dblink ADD function dblink_get_result(text,boolean);
+ALTER EXTENSION dblink ADD function dblink_get_connections();
+ALTER EXTENSION dblink ADD function dblink_cancel_query(text);
+ALTER EXTENSION dblink ADD function dblink_error_message(text);
+ALTER EXTENSION dblink ADD function dblink_get_notify();
+ALTER EXTENSION dblink ADD function dblink_get_notify(text);
diff --git a/contrib/dblink/dblink.control b/contrib/dblink/dblink.control
new file mode 100644
index 0000000000..4333a9b618
--- /dev/null
+++ b/contrib/dblink/dblink.control
@@ -0,0 +1,5 @@
+# dblink extension
+comment = 'connect to other PostgreSQL databases from within a database'
+default_version = '1.0'
+module_pathname = '$libdir/dblink'
+relocatable = true
diff --git a/contrib/dblink/expected/dblink.out b/contrib/dblink/expected/dblink.out
index 15848dd922..511dd5efcf 100644
--- a/contrib/dblink/expected/dblink.out
+++ b/contrib/dblink/expected/dblink.out
@@ -1,14 +1,4 @@
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
---
--- Define the functions and test data
--- therein.
---
--- Turn off echoing so that expected file does not depend on
--- contents of dblink.sql.
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION dblink;
CREATE TABLE foo(f1 int, f2 text, f3 text[], primary key (f1,f2));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo"
INSERT INTO foo VALUES (0,'a','{"a0","b0","c0"}');
diff --git a/contrib/dblink/sql/dblink.sql b/contrib/dblink/sql/dblink.sql
index 062bc9ee0e..8c8ffe233c 100644
--- a/contrib/dblink/sql/dblink.sql
+++ b/contrib/dblink/sql/dblink.sql
@@ -1,17 +1,4 @@
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
-
---
--- Define the functions and test data
--- therein.
---
--- Turn off echoing so that expected file does not depend on
--- contents of dblink.sql.
-SET client_min_messages = warning;
-\set ECHO none
-\i dblink.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION dblink;
CREATE TABLE foo(f1 int, f2 text, f3 text[], primary key (f1,f2));
INSERT INTO foo VALUES (0,'a','{"a0","b0","c0"}');
diff --git a/contrib/dblink/uninstall_dblink.sql b/contrib/dblink/uninstall_dblink.sql
deleted file mode 100644
index 365728a6d7..0000000000
--- a/contrib/dblink/uninstall_dblink.sql
+++ /dev/null
@@ -1,86 +0,0 @@
-/* contrib/dblink/uninstall_dblink.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION dblink_current_query ();
-
-DROP FUNCTION dblink_build_sql_update (text, int2vector, int4, _text, _text);
-
-DROP FUNCTION dblink_build_sql_delete (text, int2vector, int4, _text);
-
-DROP FUNCTION dblink_build_sql_insert (text, int2vector, int4, _text, _text);
-
-DROP FUNCTION dblink_get_pkey (text);
-
-DROP TYPE dblink_pkey_results;
-
-DROP FUNCTION dblink_exec (text,bool);
-
-DROP FUNCTION dblink_exec (text);
-
-DROP FUNCTION dblink_exec (text,text,bool);
-
-DROP FUNCTION dblink_exec (text,text);
-
-DROP FUNCTION dblink (text,bool);
-
-DROP FUNCTION dblink (text);
-
-DROP FUNCTION dblink (text,text,bool);
-
-DROP FUNCTION dblink (text,text);
-
-DROP FUNCTION dblink_close (text,text,bool);
-
-DROP FUNCTION dblink_close (text,text);
-
-DROP FUNCTION dblink_close (text,bool);
-
-DROP FUNCTION dblink_close (text);
-
-DROP FUNCTION dblink_fetch (text,text,int,bool);
-
-DROP FUNCTION dblink_fetch (text,text,int);
-
-DROP FUNCTION dblink_fetch (text,int,bool);
-
-DROP FUNCTION dblink_fetch (text,int);
-
-DROP FUNCTION dblink_open (text,text,text,bool);
-
-DROP FUNCTION dblink_open (text,text,text);
-
-DROP FUNCTION dblink_open (text,text,bool);
-
-DROP FUNCTION dblink_open (text,text);
-
-DROP FUNCTION dblink_disconnect (text);
-
-DROP FUNCTION dblink_disconnect ();
-
-DROP FUNCTION dblink_connect (text, text);
-
-DROP FUNCTION dblink_connect (text);
-
-DROP FUNCTION dblink_connect_u (text, text);
-
-DROP FUNCTION dblink_connect_u (text);
-
-DROP FUNCTION dblink_cancel_query(text);
-
-DROP FUNCTION dblink_error_message(text);
-
-DROP FUNCTION dblink_get_connections();
-
-DROP FUNCTION dblink_get_result(text);
-
-DROP FUNCTION dblink_get_result(text, boolean);
-
-DROP FUNCTION dblink_is_busy(text);
-
-DROP FUNCTION dblink_send_query(text, text);
-
-DROP FUNCTION dblink_get_notify();
-
-DROP FUNCTION dblink_get_notify(text);
diff --git a/contrib/dict_int/.gitignore b/contrib/dict_int/.gitignore
index 932dda6d84..19b6c5ba42 100644
--- a/contrib/dict_int/.gitignore
+++ b/contrib/dict_int/.gitignore
@@ -1,3 +1,2 @@
-/dict_int.sql
# Generated subdirectories
/results/
diff --git a/contrib/dict_int/Makefile b/contrib/dict_int/Makefile
index 17d9eaa5f7..3a3fc368dc 100644
--- a/contrib/dict_int/Makefile
+++ b/contrib/dict_int/Makefile
@@ -2,8 +2,10 @@
MODULE_big = dict_int
OBJS = dict_int.o
-DATA_built = dict_int.sql
-DATA = uninstall_dict_int.sql
+
+EXTENSION = dict_int
+DATA = dict_int--1.0.sql dict_int--unpackaged--1.0.sql
+
REGRESS = dict_int
ifdef USE_PGXS
diff --git a/contrib/dict_int/dict_int.sql.in b/contrib/dict_int/dict_int--1.0.sql
index 9d7ef7d9c1..a0e2b9af64 100644
--- a/contrib/dict_int/dict_int.sql.in
+++ b/contrib/dict_int/dict_int--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/dict_int/dict_int.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/dict_int/dict_int--1.0.sql */
CREATE OR REPLACE FUNCTION dintdict_init(internal)
RETURNS internal
diff --git a/contrib/dict_int/dict_int--unpackaged--1.0.sql b/contrib/dict_int/dict_int--unpackaged--1.0.sql
new file mode 100644
index 0000000000..f89218a565
--- /dev/null
+++ b/contrib/dict_int/dict_int--unpackaged--1.0.sql
@@ -0,0 +1,6 @@
+/* contrib/dict_int/dict_int--unpackaged--1.0.sql */
+
+ALTER EXTENSION dict_int ADD function dintdict_init(internal);
+ALTER EXTENSION dict_int ADD function dintdict_lexize(internal,internal,internal,internal);
+ALTER EXTENSION dict_int ADD text search template intdict_template;
+ALTER EXTENSION dict_int ADD text search dictionary intdict;
diff --git a/contrib/dict_int/dict_int.control b/contrib/dict_int/dict_int.control
new file mode 100644
index 0000000000..6e2d2b351a
--- /dev/null
+++ b/contrib/dict_int/dict_int.control
@@ -0,0 +1,5 @@
+# dict_int extension
+comment = 'text search dictionary template for integers'
+default_version = '1.0'
+module_pathname = '$libdir/dict_int'
+relocatable = true
diff --git a/contrib/dict_int/expected/dict_int.out b/contrib/dict_int/expected/dict_int.out
index 7feb493e15..3b766ec52a 100644
--- a/contrib/dict_int/expected/dict_int.out
+++ b/contrib/dict_int/expected/dict_int.out
@@ -1,10 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of this file.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION dict_int;
--lexize
select ts_lexize('intdict', '511673');
ts_lexize
diff --git a/contrib/dict_int/sql/dict_int.sql b/contrib/dict_int/sql/dict_int.sql
index 3a335f8f3d..8ffec6b770 100644
--- a/contrib/dict_int/sql/dict_int.sql
+++ b/contrib/dict_int/sql/dict_int.sql
@@ -1,12 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of this file.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i dict_int.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION dict_int;
--lexize
select ts_lexize('intdict', '511673');
diff --git a/contrib/dict_int/uninstall_dict_int.sql b/contrib/dict_int/uninstall_dict_int.sql
deleted file mode 100644
index 0467fa22ba..0000000000
--- a/contrib/dict_int/uninstall_dict_int.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-/* contrib/dict_int/uninstall_dict_int.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP TEXT SEARCH DICTIONARY intdict;
-
-DROP TEXT SEARCH TEMPLATE intdict_template;
-
-DROP FUNCTION dintdict_init(internal);
-
-DROP FUNCTION dintdict_lexize(internal,internal,internal,internal);
diff --git a/contrib/dict_xsyn/.gitignore b/contrib/dict_xsyn/.gitignore
index 0ebd61caaf..19b6c5ba42 100644
--- a/contrib/dict_xsyn/.gitignore
+++ b/contrib/dict_xsyn/.gitignore
@@ -1,3 +1,2 @@
-/dict_xsyn.sql
# Generated subdirectories
/results/
diff --git a/contrib/dict_xsyn/Makefile b/contrib/dict_xsyn/Makefile
index 8b737f09fc..ce92baa478 100644
--- a/contrib/dict_xsyn/Makefile
+++ b/contrib/dict_xsyn/Makefile
@@ -2,9 +2,11 @@
MODULE_big = dict_xsyn
OBJS = dict_xsyn.o
-DATA_built = dict_xsyn.sql
-DATA = uninstall_dict_xsyn.sql
+
+EXTENSION = dict_xsyn
+DATA = dict_xsyn--1.0.sql dict_xsyn--unpackaged--1.0.sql
DATA_TSEARCH = xsyn_sample.rules
+
REGRESS = dict_xsyn
ifdef USE_PGXS
diff --git a/contrib/dict_xsyn/dict_xsyn.sql.in b/contrib/dict_xsyn/dict_xsyn--1.0.sql
index 7d48c9209f..0b6a21730f 100644
--- a/contrib/dict_xsyn/dict_xsyn.sql.in
+++ b/contrib/dict_xsyn/dict_xsyn--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/dict_xsyn/dict_xsyn.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/dict_xsyn/dict_xsyn--1.0.sql */
CREATE OR REPLACE FUNCTION dxsyn_init(internal)
RETURNS internal
diff --git a/contrib/dict_xsyn/dict_xsyn--unpackaged--1.0.sql b/contrib/dict_xsyn/dict_xsyn--unpackaged--1.0.sql
new file mode 100644
index 0000000000..6fe0285f79
--- /dev/null
+++ b/contrib/dict_xsyn/dict_xsyn--unpackaged--1.0.sql
@@ -0,0 +1,6 @@
+/* contrib/dict_xsyn/dict_xsyn--unpackaged--1.0.sql */
+
+ALTER EXTENSION dict_xsyn ADD function dxsyn_init(internal);
+ALTER EXTENSION dict_xsyn ADD function dxsyn_lexize(internal,internal,internal,internal);
+ALTER EXTENSION dict_xsyn ADD text search template xsyn_template;
+ALTER EXTENSION dict_xsyn ADD text search dictionary xsyn;
diff --git a/contrib/dict_xsyn/dict_xsyn.control b/contrib/dict_xsyn/dict_xsyn.control
new file mode 100644
index 0000000000..3fd465a955
--- /dev/null
+++ b/contrib/dict_xsyn/dict_xsyn.control
@@ -0,0 +1,5 @@
+# dict_xsyn extension
+comment = 'text search dictionary template for extended synonym processing'
+default_version = '1.0'
+module_pathname = '$libdir/dict_xsyn'
+relocatable = true
diff --git a/contrib/dict_xsyn/expected/dict_xsyn.out b/contrib/dict_xsyn/expected/dict_xsyn.out
index d91697a97e..9b95e13559 100644
--- a/contrib/dict_xsyn/expected/dict_xsyn.out
+++ b/contrib/dict_xsyn/expected/dict_xsyn.out
@@ -1,10 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of this file.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION dict_xsyn;
-- default configuration - match first word and return it among with all synonyms
ALTER TEXT SEARCH DICTIONARY xsyn (RULES='xsyn_sample', KEEPORIG=true, MATCHORIG=true, KEEPSYNONYMS=true, MATCHSYNONYMS=false);
--lexize
diff --git a/contrib/dict_xsyn/sql/dict_xsyn.sql b/contrib/dict_xsyn/sql/dict_xsyn.sql
index 9db0851700..49511061d0 100644
--- a/contrib/dict_xsyn/sql/dict_xsyn.sql
+++ b/contrib/dict_xsyn/sql/dict_xsyn.sql
@@ -1,12 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of this file.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i dict_xsyn.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION dict_xsyn;
-- default configuration - match first word and return it among with all synonyms
ALTER TEXT SEARCH DICTIONARY xsyn (RULES='xsyn_sample', KEEPORIG=true, MATCHORIG=true, KEEPSYNONYMS=true, MATCHSYNONYMS=false);
diff --git a/contrib/dict_xsyn/uninstall_dict_xsyn.sql b/contrib/dict_xsyn/uninstall_dict_xsyn.sql
deleted file mode 100644
index 68f9579c05..0000000000
--- a/contrib/dict_xsyn/uninstall_dict_xsyn.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-/* contrib/dict_xsyn/uninstall_dict_xsyn.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP TEXT SEARCH DICTIONARY xsyn;
-
-DROP TEXT SEARCH TEMPLATE xsyn_template;
-
-DROP FUNCTION dxsyn_init(internal);
-
-DROP FUNCTION dxsyn_lexize(internal,internal,internal,internal);
diff --git a/contrib/earthdistance/.gitignore b/contrib/earthdistance/.gitignore
index 366a0a399e..19b6c5ba42 100644
--- a/contrib/earthdistance/.gitignore
+++ b/contrib/earthdistance/.gitignore
@@ -1,3 +1,2 @@
-/earthdistance.sql
# Generated subdirectories
/results/
diff --git a/contrib/earthdistance/Makefile b/contrib/earthdistance/Makefile
index 8328e5f828..49f6e6675f 100644
--- a/contrib/earthdistance/Makefile
+++ b/contrib/earthdistance/Makefile
@@ -1,8 +1,10 @@
# contrib/earthdistance/Makefile
MODULES = earthdistance
-DATA_built = earthdistance.sql
-DATA = uninstall_earthdistance.sql
+
+EXTENSION = earthdistance
+DATA = earthdistance--1.0.sql earthdistance--unpackaged--1.0.sql
+
REGRESS = earthdistance
LDFLAGS_SL += $(filter -lm, $(LIBS))
diff --git a/contrib/earthdistance/earthdistance.sql.in b/contrib/earthdistance/earthdistance--1.0.sql
index a4ce812584..0a2af648de 100644
--- a/contrib/earthdistance/earthdistance.sql.in
+++ b/contrib/earthdistance/earthdistance--1.0.sql
@@ -1,9 +1,4 @@
-/* contrib/earthdistance/earthdistance.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
-
--- The earth functions rely on contrib/cube having been installed and loaded.
+/* contrib/earthdistance/earthdistance--1.0.sql */
-- earth() returns the radius of the earth in meters. This is the only
-- place you need to change things for the cube base distance functions
diff --git a/contrib/earthdistance/earthdistance--unpackaged--1.0.sql b/contrib/earthdistance/earthdistance--unpackaged--1.0.sql
new file mode 100644
index 0000000000..2d5919cc72
--- /dev/null
+++ b/contrib/earthdistance/earthdistance--unpackaged--1.0.sql
@@ -0,0 +1,13 @@
+/* contrib/earthdistance/earthdistance--unpackaged--1.0.sql */
+
+ALTER EXTENSION earthdistance ADD function earth();
+ALTER EXTENSION earthdistance ADD type earth;
+ALTER EXTENSION earthdistance ADD function sec_to_gc(double precision);
+ALTER EXTENSION earthdistance ADD function gc_to_sec(double precision);
+ALTER EXTENSION earthdistance ADD function ll_to_earth(double precision,double precision);
+ALTER EXTENSION earthdistance ADD function latitude(earth);
+ALTER EXTENSION earthdistance ADD function longitude(earth);
+ALTER EXTENSION earthdistance ADD function earth_distance(earth,earth);
+ALTER EXTENSION earthdistance ADD function earth_box(earth,double precision);
+ALTER EXTENSION earthdistance ADD function geo_distance(point,point);
+ALTER EXTENSION earthdistance ADD operator <@>(point,point);
diff --git a/contrib/earthdistance/earthdistance.control b/contrib/earthdistance/earthdistance.control
new file mode 100644
index 0000000000..afd2ff4f95
--- /dev/null
+++ b/contrib/earthdistance/earthdistance.control
@@ -0,0 +1,6 @@
+# earthdistance extension
+comment = 'calculate great-circle distances on the surface of the Earth'
+default_version = '1.0'
+module_pathname = '$libdir/earthdistance'
+relocatable = true
+requires = 'cube'
diff --git a/contrib/earthdistance/expected/earthdistance.out b/contrib/earthdistance/expected/earthdistance.out
index 5f5645b700..8a3fc749c1 100644
--- a/contrib/earthdistance/expected/earthdistance.out
+++ b/contrib/earthdistance/expected/earthdistance.out
@@ -1,13 +1,8 @@
--
-- Test earth distance functions
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of earthdistance.sql or cube.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION cube;
+CREATE EXTENSION earthdistance;
--
-- The radius of the Earth we are using.
--
diff --git a/contrib/earthdistance/sql/earthdistance.sql b/contrib/earthdistance/sql/earthdistance.sql
index ad68b5635d..e494c350ce 100644
--- a/contrib/earthdistance/sql/earthdistance.sql
+++ b/contrib/earthdistance/sql/earthdistance.sql
@@ -2,16 +2,8 @@
-- Test earth distance functions
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of earthdistance.sql or cube.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i ../cube/cube.sql
-\i earthdistance.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION cube;
+CREATE EXTENSION earthdistance;
--
-- The radius of the Earth we are using.
diff --git a/contrib/earthdistance/uninstall_earthdistance.sql b/contrib/earthdistance/uninstall_earthdistance.sql
deleted file mode 100644
index dfd7d524ab..0000000000
--- a/contrib/earthdistance/uninstall_earthdistance.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-/* contrib/earthdistance/uninstall_earthdistance.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP OPERATOR <@> (point, point);
-
-DROP FUNCTION geo_distance (point, point);
-
-DROP FUNCTION earth_box(earth, float8);
-
-DROP FUNCTION earth_distance(earth, earth);
-
-DROP FUNCTION longitude(earth);
-
-DROP FUNCTION latitude(earth);
-
-DROP FUNCTION ll_to_earth(float8, float8);
-
-DROP FUNCTION gc_to_sec(float8);
-
-DROP FUNCTION sec_to_gc(float8);
-
-DROP DOMAIN earth;
-
-DROP FUNCTION earth();
diff --git a/contrib/fuzzystrmatch/.gitignore b/contrib/fuzzystrmatch/.gitignore
deleted file mode 100644
index f4962c630b..0000000000
--- a/contrib/fuzzystrmatch/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/fuzzystrmatch.sql
diff --git a/contrib/fuzzystrmatch/Makefile b/contrib/fuzzystrmatch/Makefile
index 9cdf3f87e3..74728a30b5 100644
--- a/contrib/fuzzystrmatch/Makefile
+++ b/contrib/fuzzystrmatch/Makefile
@@ -2,8 +2,9 @@
MODULE_big = fuzzystrmatch
OBJS = fuzzystrmatch.o dmetaphone.o
-DATA_built = fuzzystrmatch.sql
-DATA = uninstall_fuzzystrmatch.sql
+
+EXTENSION = fuzzystrmatch
+DATA = fuzzystrmatch--1.0.sql fuzzystrmatch--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.sql.in b/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
index 0f2ea85e48..1d27f5c3dd 100644
--- a/contrib/fuzzystrmatch/fuzzystrmatch.sql.in
+++ b/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/fuzzystrmatch/fuzzystrmatch.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql */
CREATE OR REPLACE FUNCTION levenshtein (text,text) RETURNS int
AS 'MODULE_PATHNAME','levenshtein'
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql b/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
new file mode 100644
index 0000000000..12077a84ae
--- /dev/null
+++ b/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
@@ -0,0 +1,12 @@
+/* contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql */
+
+ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text);
+ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text,integer,integer,integer);
+ALTER EXTENSION fuzzystrmatch ADD function levenshtein_less_equal(text,text,integer);
+ALTER EXTENSION fuzzystrmatch ADD function levenshtein_less_equal(text,text,integer,integer,integer,integer);
+ALTER EXTENSION fuzzystrmatch ADD function metaphone(text,integer);
+ALTER EXTENSION fuzzystrmatch ADD function soundex(text);
+ALTER EXTENSION fuzzystrmatch ADD function text_soundex(text);
+ALTER EXTENSION fuzzystrmatch ADD function difference(text,text);
+ALTER EXTENSION fuzzystrmatch ADD function dmetaphone(text);
+ALTER EXTENSION fuzzystrmatch ADD function dmetaphone_alt(text);
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.control b/contrib/fuzzystrmatch/fuzzystrmatch.control
new file mode 100644
index 0000000000..e257f09611
--- /dev/null
+++ b/contrib/fuzzystrmatch/fuzzystrmatch.control
@@ -0,0 +1,5 @@
+# fuzzystrmatch extension
+comment = 'determine similarities and distance between strings'
+default_version = '1.0'
+module_pathname = '$libdir/fuzzystrmatch'
+relocatable = true
diff --git a/contrib/fuzzystrmatch/uninstall_fuzzystrmatch.sql b/contrib/fuzzystrmatch/uninstall_fuzzystrmatch.sql
deleted file mode 100644
index a39c7bfc94..0000000000
--- a/contrib/fuzzystrmatch/uninstall_fuzzystrmatch.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-/* contrib/fuzzystrmatch/uninstall_fuzzystrmatch.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION dmetaphone_alt (text);
-
-DROP FUNCTION dmetaphone (text);
-
-DROP FUNCTION difference(text,text);
-
-DROP FUNCTION text_soundex(text);
-
-DROP FUNCTION soundex(text);
-
-DROP FUNCTION metaphone (text,int);
-
-DROP FUNCTION levenshtein (text,text,int,int,int);
-
-DROP FUNCTION levenshtein (text,text);
-
-DROP FUNCTION levenshtein_less_equal (text,text,int);
-
-DROP FUNCTION levenshtein_less_equal (text,text,int,int,int,int);
diff --git a/contrib/hstore/.gitignore b/contrib/hstore/.gitignore
index d7af95330c..19b6c5ba42 100644
--- a/contrib/hstore/.gitignore
+++ b/contrib/hstore/.gitignore
@@ -1,3 +1,2 @@
-/hstore.sql
# Generated subdirectories
/results/
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index 1d533fdd60..fce1a32328 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -4,8 +4,9 @@ MODULE_big = hstore
OBJS = hstore_io.o hstore_op.o hstore_gist.o hstore_gin.o hstore_compat.o \
crc32.o
-DATA_built = hstore.sql
-DATA = uninstall_hstore.sql
+EXTENSION = hstore
+DATA = hstore--1.0.sql hstore--unpackaged--1.0.sql
+
REGRESS = hstore
ifdef USE_PGXS
diff --git a/contrib/hstore/expected/hstore.out b/contrib/hstore/expected/hstore.out
index 354fff20fe..083faf8d9c 100644
--- a/contrib/hstore/expected/hstore.out
+++ b/contrib/hstore/expected/hstore.out
@@ -1,12 +1,6 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of hstore.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-psql:hstore.sql:228: WARNING: => is deprecated as an operator name
+CREATE EXTENSION hstore;
+WARNING: => is deprecated as an operator name
DETAIL: This name may be disallowed altogether in future versions of PostgreSQL.
-RESET client_min_messages;
set escape_string_warning=off;
--hstore;
select ''::hstore;
diff --git a/contrib/hstore/hstore.sql.in b/contrib/hstore/hstore--1.0.sql
index 5b39c189e1..d77b14286b 100644
--- a/contrib/hstore/hstore.sql.in
+++ b/contrib/hstore/hstore--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/hstore/hstore.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/hstore/hstore--1.0.sql */
CREATE TYPE hstore;
diff --git a/contrib/hstore/hstore--unpackaged--1.0.sql b/contrib/hstore/hstore--unpackaged--1.0.sql
new file mode 100644
index 0000000000..0eb300ecf5
--- /dev/null
+++ b/contrib/hstore/hstore--unpackaged--1.0.sql
@@ -0,0 +1,89 @@
+/* contrib/hstore/hstore--unpackaged--1.0.sql */
+
+ALTER EXTENSION hstore ADD type hstore;
+ALTER EXTENSION hstore ADD function hstore_in(cstring);
+ALTER EXTENSION hstore ADD function hstore_out(hstore);
+ALTER EXTENSION hstore ADD function hstore_recv(internal);
+ALTER EXTENSION hstore ADD function hstore_send(hstore);
+ALTER EXTENSION hstore ADD function hstore_version_diag(hstore);
+ALTER EXTENSION hstore ADD function fetchval(hstore,text);
+ALTER EXTENSION hstore ADD operator ->(hstore,text);
+ALTER EXTENSION hstore ADD function slice_array(hstore,text[]);
+ALTER EXTENSION hstore ADD operator ->(hstore,text[]);
+ALTER EXTENSION hstore ADD function slice(hstore,text[]);
+ALTER EXTENSION hstore ADD function isexists(hstore,text);
+ALTER EXTENSION hstore ADD function exist(hstore,text);
+ALTER EXTENSION hstore ADD operator ?(hstore,text);
+ALTER EXTENSION hstore ADD function exists_any(hstore,text[]);
+ALTER EXTENSION hstore ADD operator ?|(hstore,text[]);
+ALTER EXTENSION hstore ADD function exists_all(hstore,text[]);
+ALTER EXTENSION hstore ADD operator ?&(hstore,text[]);
+ALTER EXTENSION hstore ADD function isdefined(hstore,text);
+ALTER EXTENSION hstore ADD function defined(hstore,text);
+ALTER EXTENSION hstore ADD function delete(hstore,text);
+ALTER EXTENSION hstore ADD function delete(hstore,text[]);
+ALTER EXTENSION hstore ADD function delete(hstore,hstore);
+ALTER EXTENSION hstore ADD operator -(hstore,text);
+ALTER EXTENSION hstore ADD operator -(hstore,text[]);
+ALTER EXTENSION hstore ADD operator -(hstore,hstore);
+ALTER EXTENSION hstore ADD function hs_concat(hstore,hstore);
+ALTER EXTENSION hstore ADD operator ||(hstore,hstore);
+ALTER EXTENSION hstore ADD function hs_contains(hstore,hstore);
+ALTER EXTENSION hstore ADD function hs_contained(hstore,hstore);
+ALTER EXTENSION hstore ADD operator <@(hstore,hstore);
+ALTER EXTENSION hstore ADD operator @>(hstore,hstore);
+ALTER EXTENSION hstore ADD operator ~(hstore,hstore);
+ALTER EXTENSION hstore ADD operator @(hstore,hstore);
+ALTER EXTENSION hstore ADD function tconvert(text,text);
+ALTER EXTENSION hstore ADD function hstore(text,text);
+ALTER EXTENSION hstore ADD operator =>(text,text);
+ALTER EXTENSION hstore ADD function hstore(text[],text[]);
+ALTER EXTENSION hstore ADD function hstore(text[]);
+ALTER EXTENSION hstore ADD cast (text[] as hstore);
+ALTER EXTENSION hstore ADD function hstore(record);
+ALTER EXTENSION hstore ADD function hstore_to_array(hstore);
+ALTER EXTENSION hstore ADD operator %%(NONE,hstore);
+ALTER EXTENSION hstore ADD function hstore_to_matrix(hstore);
+ALTER EXTENSION hstore ADD operator %#(NONE,hstore);
+ALTER EXTENSION hstore ADD function akeys(hstore);
+ALTER EXTENSION hstore ADD function avals(hstore);
+ALTER EXTENSION hstore ADD function skeys(hstore);
+ALTER EXTENSION hstore ADD function svals(hstore);
+ALTER EXTENSION hstore ADD function each(hstore);
+ALTER EXTENSION hstore ADD function populate_record(anyelement,hstore);
+ALTER EXTENSION hstore ADD operator #=(anyelement,hstore);
+ALTER EXTENSION hstore ADD function hstore_eq(hstore,hstore);
+ALTER EXTENSION hstore ADD function hstore_ne(hstore,hstore);
+ALTER EXTENSION hstore ADD function hstore_gt(hstore,hstore);
+ALTER EXTENSION hstore ADD function hstore_ge(hstore,hstore);
+ALTER EXTENSION hstore ADD function hstore_lt(hstore,hstore);
+ALTER EXTENSION hstore ADD function hstore_le(hstore,hstore);
+ALTER EXTENSION hstore ADD function hstore_cmp(hstore,hstore);
+ALTER EXTENSION hstore ADD operator <>(hstore,hstore);
+ALTER EXTENSION hstore ADD operator =(hstore,hstore);
+ALTER EXTENSION hstore ADD operator #>#(hstore,hstore);
+ALTER EXTENSION hstore ADD operator #>=#(hstore,hstore);
+ALTER EXTENSION hstore ADD operator #<#(hstore,hstore);
+ALTER EXTENSION hstore ADD operator #<=#(hstore,hstore);
+ALTER EXTENSION hstore ADD operator family btree_hstore_ops using btree;
+ALTER EXTENSION hstore ADD operator class btree_hstore_ops using btree;
+ALTER EXTENSION hstore ADD function hstore_hash(hstore);
+ALTER EXTENSION hstore ADD operator family hash_hstore_ops using hash;
+ALTER EXTENSION hstore ADD operator class hash_hstore_ops using hash;
+ALTER EXTENSION hstore ADD type ghstore;
+ALTER EXTENSION hstore ADD function ghstore_in(cstring);
+ALTER EXTENSION hstore ADD function ghstore_out(ghstore);
+ALTER EXTENSION hstore ADD function ghstore_compress(internal);
+ALTER EXTENSION hstore ADD function ghstore_decompress(internal);
+ALTER EXTENSION hstore ADD function ghstore_penalty(internal,internal,internal);
+ALTER EXTENSION hstore ADD function ghstore_picksplit(internal,internal);
+ALTER EXTENSION hstore ADD function ghstore_union(internal,internal);
+ALTER EXTENSION hstore ADD function ghstore_same(internal,internal,internal);
+ALTER EXTENSION hstore ADD function ghstore_consistent(internal,internal,integer,oid,internal);
+ALTER EXTENSION hstore ADD operator family gist_hstore_ops using gist;
+ALTER EXTENSION hstore ADD operator class gist_hstore_ops using gist;
+ALTER EXTENSION hstore ADD function gin_extract_hstore(internal,internal);
+ALTER EXTENSION hstore ADD function gin_extract_hstore_query(internal,internal,smallint,internal,internal);
+ALTER EXTENSION hstore ADD function gin_consistent_hstore(internal,smallint,internal,integer,internal,internal);
+ALTER EXTENSION hstore ADD operator family gin_hstore_ops using gin;
+ALTER EXTENSION hstore ADD operator class gin_hstore_ops using gin;
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
new file mode 100644
index 0000000000..0a57b3487b
--- /dev/null
+++ b/contrib/hstore/hstore.control
@@ -0,0 +1,5 @@
+# hstore extension
+comment = 'store sets of (key, value) pairs'
+default_version = '1.0'
+module_pathname = '$libdir/hstore'
+relocatable = true
diff --git a/contrib/hstore/sql/hstore.sql b/contrib/hstore/sql/hstore.sql
index 58a7967526..fb6bb59f8a 100644
--- a/contrib/hstore/sql/hstore.sql
+++ b/contrib/hstore/sql/hstore.sql
@@ -1,12 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of hstore.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i hstore.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION hstore;
set escape_string_warning=off;
diff --git a/contrib/hstore/uninstall_hstore.sql b/contrib/hstore/uninstall_hstore.sql
deleted file mode 100644
index a03e43164f..0000000000
--- a/contrib/hstore/uninstall_hstore.sql
+++ /dev/null
@@ -1,86 +0,0 @@
-/* contrib/hstore/uninstall_hstore.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP OPERATOR CLASS gist_hstore_ops USING gist CASCADE;
-DROP OPERATOR CLASS gin_hstore_ops USING gin CASCADE;
-DROP OPERATOR CLASS hash_hstore_ops USING hash CASCADE;
-DROP OPERATOR CLASS btree_hstore_ops USING btree CASCADE;
-
-DROP OPERATOR - ( hstore, text );
-DROP OPERATOR - ( hstore, text[] );
-DROP OPERATOR - ( hstore, hstore );
-DROP OPERATOR ? ( hstore, text );
-DROP OPERATOR ?& ( hstore, text[] );
-DROP OPERATOR ?| ( hstore, text[] );
-DROP OPERATOR -> ( hstore, text );
-DROP OPERATOR -> ( hstore, text[] );
-DROP OPERATOR || ( hstore, hstore );
-DROP OPERATOR @> ( hstore, hstore );
-DROP OPERATOR <@ ( hstore, hstore );
-DROP OPERATOR @ ( hstore, hstore );
-DROP OPERATOR ~ ( hstore, hstore );
-DROP OPERATOR => ( text, text );
-DROP OPERATOR #= ( anyelement, hstore );
-DROP OPERATOR %% ( NONE, hstore );
-DROP OPERATOR %# ( NONE, hstore );
-DROP OPERATOR = ( hstore, hstore );
-DROP OPERATOR <> ( hstore, hstore );
-DROP OPERATOR #<# ( hstore, hstore );
-DROP OPERATOR #<=# ( hstore, hstore );
-DROP OPERATOR #># ( hstore, hstore );
-DROP OPERATOR #>=# ( hstore, hstore );
-
-DROP CAST (text[] AS hstore);
-
-DROP FUNCTION hstore_eq(hstore,hstore);
-DROP FUNCTION hstore_ne(hstore,hstore);
-DROP FUNCTION hstore_gt(hstore,hstore);
-DROP FUNCTION hstore_ge(hstore,hstore);
-DROP FUNCTION hstore_lt(hstore,hstore);
-DROP FUNCTION hstore_le(hstore,hstore);
-DROP FUNCTION hstore_cmp(hstore,hstore);
-DROP FUNCTION hstore_hash(hstore);
-DROP FUNCTION slice_array(hstore,text[]);
-DROP FUNCTION slice(hstore,text[]);
-DROP FUNCTION fetchval(hstore,text);
-DROP FUNCTION isexists(hstore,text);
-DROP FUNCTION exist(hstore,text);
-DROP FUNCTION exists_any(hstore,text[]);
-DROP FUNCTION exists_all(hstore,text[]);
-DROP FUNCTION isdefined(hstore,text);
-DROP FUNCTION defined(hstore,text);
-DROP FUNCTION delete(hstore,text);
-DROP FUNCTION delete(hstore,text[]);
-DROP FUNCTION delete(hstore,hstore);
-DROP FUNCTION hs_concat(hstore,hstore);
-DROP FUNCTION hs_contains(hstore,hstore);
-DROP FUNCTION hs_contained(hstore,hstore);
-DROP FUNCTION tconvert(text,text);
-DROP FUNCTION hstore(text,text);
-DROP FUNCTION hstore(text[],text[]);
-DROP FUNCTION hstore_to_array(hstore);
-DROP FUNCTION hstore_to_matrix(hstore);
-DROP FUNCTION hstore(record);
-DROP FUNCTION hstore(text[]);
-DROP FUNCTION akeys(hstore);
-DROP FUNCTION avals(hstore);
-DROP FUNCTION skeys(hstore);
-DROP FUNCTION svals(hstore);
-DROP FUNCTION each(hstore);
-DROP FUNCTION populate_record(anyelement,hstore);
-DROP FUNCTION ghstore_compress(internal);
-DROP FUNCTION ghstore_decompress(internal);
-DROP FUNCTION ghstore_penalty(internal,internal,internal);
-DROP FUNCTION ghstore_picksplit(internal, internal);
-DROP FUNCTION ghstore_union(internal, internal);
-DROP FUNCTION ghstore_same(internal, internal, internal);
-DROP FUNCTION ghstore_consistent(internal,internal,int,oid,internal);
-DROP FUNCTION gin_consistent_hstore(internal, int2, internal, int4, internal, internal);
-DROP FUNCTION gin_extract_hstore(internal, internal);
-DROP FUNCTION gin_extract_hstore_query(internal, internal, smallint, internal, internal);
-DROP FUNCTION hstore_version_diag(hstore);
-
-DROP TYPE hstore CASCADE;
-DROP TYPE ghstore CASCADE;
diff --git a/contrib/intagg/Makefile b/contrib/intagg/Makefile
index 9bb1866e78..372c0919a7 100644
--- a/contrib/intagg/Makefile
+++ b/contrib/intagg/Makefile
@@ -1,6 +1,7 @@
# contrib/intagg/Makefile
-DATA = int_aggregate.sql uninstall_int_aggregate.sql
+EXTENSION = int_aggregate
+DATA = int_aggregate--1.0.sql int_aggregate--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/intagg/int_aggregate.sql b/contrib/intagg/int_aggregate--1.0.sql
index 289e41b671..3df72c18cf 100644
--- a/contrib/intagg/int_aggregate.sql
+++ b/contrib/intagg/int_aggregate--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/intagg/int_aggregate.sql */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/intagg/int_aggregate--1.0.sql */
-- Internal function for the aggregate
-- Is called for each item in an aggregation
diff --git a/contrib/intagg/int_aggregate--unpackaged--1.0.sql b/contrib/intagg/int_aggregate--unpackaged--1.0.sql
new file mode 100644
index 0000000000..0bc874e645
--- /dev/null
+++ b/contrib/intagg/int_aggregate--unpackaged--1.0.sql
@@ -0,0 +1,6 @@
+/* contrib/intagg/int_aggregate--unpackaged--1.0.sql */
+
+ALTER EXTENSION int_aggregate ADD function int_agg_state(internal,integer);
+ALTER EXTENSION int_aggregate ADD function int_agg_final_array(internal);
+ALTER EXTENSION int_aggregate ADD function int_array_aggregate(integer);
+ALTER EXTENSION int_aggregate ADD function int_array_enum(integer[]);
diff --git a/contrib/intagg/int_aggregate.control b/contrib/intagg/int_aggregate.control
new file mode 100644
index 0000000000..f8e47d5a7f
--- /dev/null
+++ b/contrib/intagg/int_aggregate.control
@@ -0,0 +1,4 @@
+# int_aggregate extension
+comment = 'integer aggregator and enumerator (obsolete)'
+default_version = '1.0'
+relocatable = true
diff --git a/contrib/intagg/uninstall_int_aggregate.sql b/contrib/intagg/uninstall_int_aggregate.sql
deleted file mode 100644
index 2e55345325..0000000000
--- a/contrib/intagg/uninstall_int_aggregate.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-/* contrib/intagg/uninstall_int_aggregate.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION int_array_enum(int4[]);
-
-DROP AGGREGATE int_array_aggregate (int4);
-
-DROP FUNCTION int_agg_final_array (internal);
-
-DROP FUNCTION int_agg_state (internal, int4);
diff --git a/contrib/intarray/.gitignore b/contrib/intarray/.gitignore
index 761a9b2607..19b6c5ba42 100644
--- a/contrib/intarray/.gitignore
+++ b/contrib/intarray/.gitignore
@@ -1,3 +1,2 @@
-/_int.sql
# Generated subdirectories
/results/
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index a10d7c6b1f..71f820ec4a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -2,8 +2,10 @@
MODULE_big = _int
OBJS = _int_bool.o _int_gist.o _int_op.o _int_tool.o _intbig_gist.o _int_gin.o
-DATA_built = _int.sql
-DATA = uninstall__int.sql
+
+EXTENSION = intarray
+DATA = intarray--1.0.sql intarray--unpackaged--1.0.sql
+
REGRESS = _int
ifdef USE_PGXS
diff --git a/contrib/intarray/expected/_int.out b/contrib/intarray/expected/_int.out
index 596439d314..6ed3cc6ced 100644
--- a/contrib/intarray/expected/_int.out
+++ b/contrib/intarray/expected/_int.out
@@ -1,10 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of _int.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION intarray;
SELECT intset(1234);
intset
--------
diff --git a/contrib/intarray/_int.sql.in b/contrib/intarray/intarray--1.0.sql
index ad224e319b..5f86ee607f 100644
--- a/contrib/intarray/_int.sql.in
+++ b/contrib/intarray/intarray--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/intarray/_int.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/intarray/intarray--1.0.sql */
--
-- Create the user-defined type for the 1-D integer arrays (_int4)
diff --git a/contrib/intarray/intarray--unpackaged--1.0.sql b/contrib/intarray/intarray--unpackaged--1.0.sql
new file mode 100644
index 0000000000..7fd739b0ed
--- /dev/null
+++ b/contrib/intarray/intarray--unpackaged--1.0.sql
@@ -0,0 +1,71 @@
+/* contrib/intarray/intarray--unpackaged--1.0.sql */
+
+ALTER EXTENSION intarray ADD type query_int;
+ALTER EXTENSION intarray ADD function bqarr_in(cstring);
+ALTER EXTENSION intarray ADD function bqarr_out(query_int);
+ALTER EXTENSION intarray ADD function querytree(query_int);
+ALTER EXTENSION intarray ADD function boolop(integer[],query_int);
+ALTER EXTENSION intarray ADD function rboolop(query_int,integer[]);
+ALTER EXTENSION intarray ADD operator ~~(query_int,integer[]);
+ALTER EXTENSION intarray ADD operator @@(integer[],query_int);
+ALTER EXTENSION intarray ADD function _int_contains(integer[],integer[]);
+ALTER EXTENSION intarray ADD function _int_contained(integer[],integer[]);
+ALTER EXTENSION intarray ADD function _int_overlap(integer[],integer[]);
+ALTER EXTENSION intarray ADD function _int_same(integer[],integer[]);
+ALTER EXTENSION intarray ADD function _int_different(integer[],integer[]);
+ALTER EXTENSION intarray ADD function _int_union(integer[],integer[]);
+ALTER EXTENSION intarray ADD function _int_inter(integer[],integer[]);
+ALTER EXTENSION intarray ADD operator &&(integer[],integer[]);
+ALTER EXTENSION intarray ADD operator <@(integer[],integer[]);
+ALTER EXTENSION intarray ADD operator @>(integer[],integer[]);
+ALTER EXTENSION intarray ADD operator ~(integer[],integer[]);
+ALTER EXTENSION intarray ADD operator @(integer[],integer[]);
+ALTER EXTENSION intarray ADD function intset(integer);
+ALTER EXTENSION intarray ADD function icount(integer[]);
+ALTER EXTENSION intarray ADD operator #(NONE,integer[]);
+ALTER EXTENSION intarray ADD function sort(integer[],text);
+ALTER EXTENSION intarray ADD function sort(integer[]);
+ALTER EXTENSION intarray ADD function sort_asc(integer[]);
+ALTER EXTENSION intarray ADD function sort_desc(integer[]);
+ALTER EXTENSION intarray ADD function uniq(integer[]);
+ALTER EXTENSION intarray ADD function idx(integer[],integer);
+ALTER EXTENSION intarray ADD operator #(integer[],integer);
+ALTER EXTENSION intarray ADD function subarray(integer[],integer,integer);
+ALTER EXTENSION intarray ADD function subarray(integer[],integer);
+ALTER EXTENSION intarray ADD function intarray_push_elem(integer[],integer);
+ALTER EXTENSION intarray ADD operator +(integer[],integer);
+ALTER EXTENSION intarray ADD function intarray_push_array(integer[],integer[]);
+ALTER EXTENSION intarray ADD operator +(integer[],integer[]);
+ALTER EXTENSION intarray ADD function intarray_del_elem(integer[],integer);
+ALTER EXTENSION intarray ADD operator -(integer[],integer);
+ALTER EXTENSION intarray ADD function intset_union_elem(integer[],integer);
+ALTER EXTENSION intarray ADD operator |(integer[],integer);
+ALTER EXTENSION intarray ADD operator |(integer[],integer[]);
+ALTER EXTENSION intarray ADD function intset_subtract(integer[],integer[]);
+ALTER EXTENSION intarray ADD operator -(integer[],integer[]);
+ALTER EXTENSION intarray ADD operator &(integer[],integer[]);
+ALTER EXTENSION intarray ADD function g_int_consistent(internal,integer[],integer,oid,internal);
+ALTER EXTENSION intarray ADD function g_int_compress(internal);
+ALTER EXTENSION intarray ADD function g_int_decompress(internal);
+ALTER EXTENSION intarray ADD function g_int_penalty(internal,internal,internal);
+ALTER EXTENSION intarray ADD function g_int_picksplit(internal,internal);
+ALTER EXTENSION intarray ADD function g_int_union(internal,internal);
+ALTER EXTENSION intarray ADD function g_int_same(integer[],integer[],internal);
+ALTER EXTENSION intarray ADD operator family gist__int_ops using gist;
+ALTER EXTENSION intarray ADD operator class gist__int_ops using gist;
+ALTER EXTENSION intarray ADD type intbig_gkey;
+ALTER EXTENSION intarray ADD function _intbig_in(cstring);
+ALTER EXTENSION intarray ADD function _intbig_out(intbig_gkey);
+ALTER EXTENSION intarray ADD function g_intbig_consistent(internal,internal,integer,oid,internal);
+ALTER EXTENSION intarray ADD function g_intbig_compress(internal);
+ALTER EXTENSION intarray ADD function g_intbig_decompress(internal);
+ALTER EXTENSION intarray ADD function g_intbig_penalty(internal,internal,internal);
+ALTER EXTENSION intarray ADD function g_intbig_picksplit(internal,internal);
+ALTER EXTENSION intarray ADD function g_intbig_union(internal,internal);
+ALTER EXTENSION intarray ADD function g_intbig_same(internal,internal,internal);
+ALTER EXTENSION intarray ADD operator family gist__intbig_ops using gist;
+ALTER EXTENSION intarray ADD operator class gist__intbig_ops using gist;
+ALTER EXTENSION intarray ADD function ginint4_queryextract(internal,internal,smallint,internal,internal,internal,internal);
+ALTER EXTENSION intarray ADD function ginint4_consistent(internal,smallint,internal,integer,internal,internal,internal,internal);
+ALTER EXTENSION intarray ADD operator family gin__int_ops using gin;
+ALTER EXTENSION intarray ADD operator class gin__int_ops using gin;
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
new file mode 100644
index 0000000000..7b3d4f78f0
--- /dev/null
+++ b/contrib/intarray/intarray.control
@@ -0,0 +1,5 @@
+# intarray extension
+comment = 'functions, operators, and index support for 1-D arrays of integers'
+default_version = '1.0'
+module_pathname = '$libdir/_int'
+relocatable = true
diff --git a/contrib/intarray/sql/_int.sql b/contrib/intarray/sql/_int.sql
index 1588e3b514..b60e936dc5 100644
--- a/contrib/intarray/sql/_int.sql
+++ b/contrib/intarray/sql/_int.sql
@@ -1,12 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of _int.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i _int.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION intarray;
SELECT intset(1234);
SELECT icount('{1234234,234234}');
diff --git a/contrib/intarray/uninstall__int.sql b/contrib/intarray/uninstall__int.sql
deleted file mode 100644
index 345ad4464b..0000000000
--- a/contrib/intarray/uninstall__int.sql
+++ /dev/null
@@ -1,128 +0,0 @@
-/* contrib/intarray/uninstall__int.sql */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
-
-DROP OPERATOR CLASS gin__int_ops USING gin;
-
-DROP FUNCTION ginint4_queryextract(internal, internal, int2, internal, internal, internal, internal);
-
-DROP FUNCTION ginint4_consistent(internal, int2, internal, int4, internal, internal, internal, internal);
-
-DROP OPERATOR CLASS gist__intbig_ops USING gist;
-
-DROP FUNCTION g_intbig_same(internal, internal, internal);
-
-DROP FUNCTION g_intbig_union(internal, internal);
-
-DROP FUNCTION g_intbig_picksplit(internal, internal);
-
-DROP FUNCTION g_intbig_penalty(internal,internal,internal);
-
-DROP FUNCTION g_intbig_decompress(internal);
-
-DROP FUNCTION g_intbig_compress(internal);
-
-DROP FUNCTION g_intbig_consistent(internal,internal,int,oid,internal);
-
-DROP TYPE intbig_gkey CASCADE;
-
-DROP OPERATOR CLASS gist__int_ops USING gist;
-
-DROP FUNCTION g_int_same(_int4, _int4, internal);
-
-DROP FUNCTION g_int_union(internal, internal);
-
-DROP FUNCTION g_int_picksplit(internal, internal);
-
-DROP FUNCTION g_int_penalty(internal,internal,internal);
-
-DROP FUNCTION g_int_decompress(internal);
-
-DROP FUNCTION g_int_compress(internal);
-
-DROP FUNCTION g_int_consistent(internal,_int4,int,oid,internal);
-
-DROP OPERATOR & (_int4, _int4);
-
-DROP OPERATOR - (_int4, _int4);
-
-DROP FUNCTION intset_subtract(_int4, _int4);
-
-DROP OPERATOR | (_int4, _int4);
-
-DROP OPERATOR | (_int4, int4);
-
-DROP FUNCTION intset_union_elem(_int4, int4);
-
-DROP OPERATOR - (_int4, int4);
-
-DROP FUNCTION intarray_del_elem(_int4, int4);
-
-DROP OPERATOR + (_int4, _int4);
-
-DROP FUNCTION intarray_push_array(_int4, _int4);
-
-DROP OPERATOR + (_int4, int4);
-
-DROP FUNCTION intarray_push_elem(_int4, int4);
-
-DROP FUNCTION subarray(_int4, int4);
-
-DROP FUNCTION subarray(_int4, int4, int4);
-
-DROP OPERATOR # (_int4, int4);
-
-DROP FUNCTION idx(_int4, int4);
-
-DROP FUNCTION uniq(_int4);
-
-DROP FUNCTION sort_desc(_int4);
-
-DROP FUNCTION sort_asc(_int4);
-
-DROP FUNCTION sort(_int4);
-
-DROP FUNCTION sort(_int4, text);
-
-DROP OPERATOR # (NONE, _int4);
-
-DROP FUNCTION icount(_int4);
-
-DROP FUNCTION intset(int4);
-
-DROP OPERATOR <@ (_int4, _int4);
-
-DROP OPERATOR @> (_int4, _int4);
-
-DROP OPERATOR ~ (_int4, _int4);
-
-DROP OPERATOR @ (_int4, _int4);
-
-DROP OPERATOR && (_int4, _int4);
-
-DROP FUNCTION _int_inter(_int4, _int4);
-
-DROP FUNCTION _int_union(_int4, _int4);
-
-DROP FUNCTION _int_different(_int4, _int4);
-
-DROP FUNCTION _int_same(_int4, _int4);
-
-DROP FUNCTION _int_overlap(_int4, _int4);
-
-DROP FUNCTION _int_contained(_int4, _int4);
-
-DROP FUNCTION _int_contains(_int4, _int4);
-
-DROP OPERATOR ~~ (query_int, _int4);
-
-DROP OPERATOR @@ (_int4, query_int);
-
-DROP FUNCTION rboolop(query_int, _int4);
-
-DROP FUNCTION boolop(_int4, query_int);
-
-DROP FUNCTION querytree(query_int);
-
-DROP TYPE query_int CASCADE;
diff --git a/contrib/isn/.gitignore b/contrib/isn/.gitignore
deleted file mode 100644
index 1df12e3b75..0000000000
--- a/contrib/isn/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/isn.sql
diff --git a/contrib/isn/Makefile b/contrib/isn/Makefile
index ae33b758fb..bd8f193e93 100644
--- a/contrib/isn/Makefile
+++ b/contrib/isn/Makefile
@@ -1,8 +1,9 @@
# contrib/isn/Makefile
MODULES = isn
-DATA_built = isn.sql
-DATA = uninstall_isn.sql
+
+EXTENSION = isn
+DATA = isn--1.0.sql isn--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/isn/isn.sql.in b/contrib/isn/isn--1.0.sql
index 8f73c5c497..a6499f267a 100644
--- a/contrib/isn/isn.sql.in
+++ b/contrib/isn/isn--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/isn/isn.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/isn/isn--1.0.sql */
-- Example:
-- create table test ( id isbn );
diff --git a/contrib/isn/isn--unpackaged--1.0.sql b/contrib/isn/isn--unpackaged--1.0.sql
new file mode 100644
index 0000000000..6130a43e51
--- /dev/null
+++ b/contrib/isn/isn--unpackaged--1.0.sql
@@ -0,0 +1,461 @@
+/* contrib/isn/isn--unpackaged--1.0.sql */
+
+ALTER EXTENSION isn ADD type ean13;
+ALTER EXTENSION isn ADD function ean13_in(cstring);
+ALTER EXTENSION isn ADD function ean13_out(ean13);
+ALTER EXTENSION isn ADD type isbn13;
+ALTER EXTENSION isn ADD function isbn13_in(cstring);
+ALTER EXTENSION isn ADD function ean13_out(isbn13);
+ALTER EXTENSION isn ADD type ismn13;
+ALTER EXTENSION isn ADD function ismn13_in(cstring);
+ALTER EXTENSION isn ADD function ean13_out(ismn13);
+ALTER EXTENSION isn ADD type issn13;
+ALTER EXTENSION isn ADD function issn13_in(cstring);
+ALTER EXTENSION isn ADD function ean13_out(issn13);
+ALTER EXTENSION isn ADD type isbn;
+ALTER EXTENSION isn ADD function isbn_in(cstring);
+ALTER EXTENSION isn ADD function isn_out(isbn);
+ALTER EXTENSION isn ADD type ismn;
+ALTER EXTENSION isn ADD function ismn_in(cstring);
+ALTER EXTENSION isn ADD function isn_out(ismn);
+ALTER EXTENSION isn ADD type issn;
+ALTER EXTENSION isn ADD function issn_in(cstring);
+ALTER EXTENSION isn ADD function isn_out(issn);
+ALTER EXTENSION isn ADD type upc;
+ALTER EXTENSION isn ADD function upc_in(cstring);
+ALTER EXTENSION isn ADD function isn_out(upc);
+ALTER EXTENSION isn ADD function isnlt(ean13,ean13);
+ALTER EXTENSION isn ADD function isnle(ean13,ean13);
+ALTER EXTENSION isn ADD function isneq(ean13,ean13);
+ALTER EXTENSION isn ADD function isnge(ean13,ean13);
+ALTER EXTENSION isn ADD function isngt(ean13,ean13);
+ALTER EXTENSION isn ADD function isnne(ean13,ean13);
+ALTER EXTENSION isn ADD function isnlt(ean13,isbn13);
+ALTER EXTENSION isn ADD function isnle(ean13,isbn13);
+ALTER EXTENSION isn ADD function isneq(ean13,isbn13);
+ALTER EXTENSION isn ADD function isnge(ean13,isbn13);
+ALTER EXTENSION isn ADD function isngt(ean13,isbn13);
+ALTER EXTENSION isn ADD function isnne(ean13,isbn13);
+ALTER EXTENSION isn ADD function isnlt(ean13,ismn13);
+ALTER EXTENSION isn ADD function isnle(ean13,ismn13);
+ALTER EXTENSION isn ADD function isneq(ean13,ismn13);
+ALTER EXTENSION isn ADD function isnge(ean13,ismn13);
+ALTER EXTENSION isn ADD function isngt(ean13,ismn13);
+ALTER EXTENSION isn ADD function isnne(ean13,ismn13);
+ALTER EXTENSION isn ADD function isnlt(ean13,issn13);
+ALTER EXTENSION isn ADD function isnle(ean13,issn13);
+ALTER EXTENSION isn ADD function isneq(ean13,issn13);
+ALTER EXTENSION isn ADD function isnge(ean13,issn13);
+ALTER EXTENSION isn ADD function isngt(ean13,issn13);
+ALTER EXTENSION isn ADD function isnne(ean13,issn13);
+ALTER EXTENSION isn ADD function isnlt(ean13,isbn);
+ALTER EXTENSION isn ADD function isnle(ean13,isbn);
+ALTER EXTENSION isn ADD function isneq(ean13,isbn);
+ALTER EXTENSION isn ADD function isnge(ean13,isbn);
+ALTER EXTENSION isn ADD function isngt(ean13,isbn);
+ALTER EXTENSION isn ADD function isnne(ean13,isbn);
+ALTER EXTENSION isn ADD function isnlt(ean13,ismn);
+ALTER EXTENSION isn ADD function isnle(ean13,ismn);
+ALTER EXTENSION isn ADD function isneq(ean13,ismn);
+ALTER EXTENSION isn ADD function isnge(ean13,ismn);
+ALTER EXTENSION isn ADD function isngt(ean13,ismn);
+ALTER EXTENSION isn ADD function isnne(ean13,ismn);
+ALTER EXTENSION isn ADD function isnlt(ean13,issn);
+ALTER EXTENSION isn ADD function isnle(ean13,issn);
+ALTER EXTENSION isn ADD function isneq(ean13,issn);
+ALTER EXTENSION isn ADD function isnge(ean13,issn);
+ALTER EXTENSION isn ADD function isngt(ean13,issn);
+ALTER EXTENSION isn ADD function isnne(ean13,issn);
+ALTER EXTENSION isn ADD function isnlt(ean13,upc);
+ALTER EXTENSION isn ADD function isnle(ean13,upc);
+ALTER EXTENSION isn ADD function isneq(ean13,upc);
+ALTER EXTENSION isn ADD function isnge(ean13,upc);
+ALTER EXTENSION isn ADD function isngt(ean13,upc);
+ALTER EXTENSION isn ADD function isnne(ean13,upc);
+ALTER EXTENSION isn ADD function isnlt(isbn13,isbn13);
+ALTER EXTENSION isn ADD function isnle(isbn13,isbn13);
+ALTER EXTENSION isn ADD function isneq(isbn13,isbn13);
+ALTER EXTENSION isn ADD function isnge(isbn13,isbn13);
+ALTER EXTENSION isn ADD function isngt(isbn13,isbn13);
+ALTER EXTENSION isn ADD function isnne(isbn13,isbn13);
+ALTER EXTENSION isn ADD function isnlt(isbn13,isbn);
+ALTER EXTENSION isn ADD function isnle(isbn13,isbn);
+ALTER EXTENSION isn ADD function isneq(isbn13,isbn);
+ALTER EXTENSION isn ADD function isnge(isbn13,isbn);
+ALTER EXTENSION isn ADD function isngt(isbn13,isbn);
+ALTER EXTENSION isn ADD function isnne(isbn13,isbn);
+ALTER EXTENSION isn ADD function isnlt(isbn13,ean13);
+ALTER EXTENSION isn ADD function isnle(isbn13,ean13);
+ALTER EXTENSION isn ADD function isneq(isbn13,ean13);
+ALTER EXTENSION isn ADD function isnge(isbn13,ean13);
+ALTER EXTENSION isn ADD function isngt(isbn13,ean13);
+ALTER EXTENSION isn ADD function isnne(isbn13,ean13);
+ALTER EXTENSION isn ADD function isnlt(isbn,isbn);
+ALTER EXTENSION isn ADD function isnle(isbn,isbn);
+ALTER EXTENSION isn ADD function isneq(isbn,isbn);
+ALTER EXTENSION isn ADD function isnge(isbn,isbn);
+ALTER EXTENSION isn ADD function isngt(isbn,isbn);
+ALTER EXTENSION isn ADD function isnne(isbn,isbn);
+ALTER EXTENSION isn ADD function isnlt(isbn,isbn13);
+ALTER EXTENSION isn ADD function isnle(isbn,isbn13);
+ALTER EXTENSION isn ADD function isneq(isbn,isbn13);
+ALTER EXTENSION isn ADD function isnge(isbn,isbn13);
+ALTER EXTENSION isn ADD function isngt(isbn,isbn13);
+ALTER EXTENSION isn ADD function isnne(isbn,isbn13);
+ALTER EXTENSION isn ADD function isnlt(isbn,ean13);
+ALTER EXTENSION isn ADD function isnle(isbn,ean13);
+ALTER EXTENSION isn ADD function isneq(isbn,ean13);
+ALTER EXTENSION isn ADD function isnge(isbn,ean13);
+ALTER EXTENSION isn ADD function isngt(isbn,ean13);
+ALTER EXTENSION isn ADD function isnne(isbn,ean13);
+ALTER EXTENSION isn ADD function isnlt(ismn13,ismn13);
+ALTER EXTENSION isn ADD function isnle(ismn13,ismn13);
+ALTER EXTENSION isn ADD function isneq(ismn13,ismn13);
+ALTER EXTENSION isn ADD function isnge(ismn13,ismn13);
+ALTER EXTENSION isn ADD function isngt(ismn13,ismn13);
+ALTER EXTENSION isn ADD function isnne(ismn13,ismn13);
+ALTER EXTENSION isn ADD function isnlt(ismn13,ismn);
+ALTER EXTENSION isn ADD function isnle(ismn13,ismn);
+ALTER EXTENSION isn ADD function isneq(ismn13,ismn);
+ALTER EXTENSION isn ADD function isnge(ismn13,ismn);
+ALTER EXTENSION isn ADD function isngt(ismn13,ismn);
+ALTER EXTENSION isn ADD function isnne(ismn13,ismn);
+ALTER EXTENSION isn ADD function isnlt(ismn13,ean13);
+ALTER EXTENSION isn ADD function isnle(ismn13,ean13);
+ALTER EXTENSION isn ADD function isneq(ismn13,ean13);
+ALTER EXTENSION isn ADD function isnge(ismn13,ean13);
+ALTER EXTENSION isn ADD function isngt(ismn13,ean13);
+ALTER EXTENSION isn ADD function isnne(ismn13,ean13);
+ALTER EXTENSION isn ADD function isnlt(ismn,ismn);
+ALTER EXTENSION isn ADD function isnle(ismn,ismn);
+ALTER EXTENSION isn ADD function isneq(ismn,ismn);
+ALTER EXTENSION isn ADD function isnge(ismn,ismn);
+ALTER EXTENSION isn ADD function isngt(ismn,ismn);
+ALTER EXTENSION isn ADD function isnne(ismn,ismn);
+ALTER EXTENSION isn ADD function isnlt(ismn,ismn13);
+ALTER EXTENSION isn ADD function isnle(ismn,ismn13);
+ALTER EXTENSION isn ADD function isneq(ismn,ismn13);
+ALTER EXTENSION isn ADD function isnge(ismn,ismn13);
+ALTER EXTENSION isn ADD function isngt(ismn,ismn13);
+ALTER EXTENSION isn ADD function isnne(ismn,ismn13);
+ALTER EXTENSION isn ADD function isnlt(ismn,ean13);
+ALTER EXTENSION isn ADD function isnle(ismn,ean13);
+ALTER EXTENSION isn ADD function isneq(ismn,ean13);
+ALTER EXTENSION isn ADD function isnge(ismn,ean13);
+ALTER EXTENSION isn ADD function isngt(ismn,ean13);
+ALTER EXTENSION isn ADD function isnne(ismn,ean13);
+ALTER EXTENSION isn ADD function isnlt(issn13,issn13);
+ALTER EXTENSION isn ADD function isnle(issn13,issn13);
+ALTER EXTENSION isn ADD function isneq(issn13,issn13);
+ALTER EXTENSION isn ADD function isnge(issn13,issn13);
+ALTER EXTENSION isn ADD function isngt(issn13,issn13);
+ALTER EXTENSION isn ADD function isnne(issn13,issn13);
+ALTER EXTENSION isn ADD function isnlt(issn13,issn);
+ALTER EXTENSION isn ADD function isnle(issn13,issn);
+ALTER EXTENSION isn ADD function isneq(issn13,issn);
+ALTER EXTENSION isn ADD function isnge(issn13,issn);
+ALTER EXTENSION isn ADD function isngt(issn13,issn);
+ALTER EXTENSION isn ADD function isnne(issn13,issn);
+ALTER EXTENSION isn ADD function isnlt(issn13,ean13);
+ALTER EXTENSION isn ADD function isnle(issn13,ean13);
+ALTER EXTENSION isn ADD function isneq(issn13,ean13);
+ALTER EXTENSION isn ADD function isnge(issn13,ean13);
+ALTER EXTENSION isn ADD function isngt(issn13,ean13);
+ALTER EXTENSION isn ADD function isnne(issn13,ean13);
+ALTER EXTENSION isn ADD function isnlt(issn,issn);
+ALTER EXTENSION isn ADD function isnle(issn,issn);
+ALTER EXTENSION isn ADD function isneq(issn,issn);
+ALTER EXTENSION isn ADD function isnge(issn,issn);
+ALTER EXTENSION isn ADD function isngt(issn,issn);
+ALTER EXTENSION isn ADD function isnne(issn,issn);
+ALTER EXTENSION isn ADD function isnlt(issn,issn13);
+ALTER EXTENSION isn ADD function isnle(issn,issn13);
+ALTER EXTENSION isn ADD function isneq(issn,issn13);
+ALTER EXTENSION isn ADD function isnge(issn,issn13);
+ALTER EXTENSION isn ADD function isngt(issn,issn13);
+ALTER EXTENSION isn ADD function isnne(issn,issn13);
+ALTER EXTENSION isn ADD function isnlt(issn,ean13);
+ALTER EXTENSION isn ADD function isnle(issn,ean13);
+ALTER EXTENSION isn ADD function isneq(issn,ean13);
+ALTER EXTENSION isn ADD function isnge(issn,ean13);
+ALTER EXTENSION isn ADD function isngt(issn,ean13);
+ALTER EXTENSION isn ADD function isnne(issn,ean13);
+ALTER EXTENSION isn ADD function isnlt(upc,upc);
+ALTER EXTENSION isn ADD function isnle(upc,upc);
+ALTER EXTENSION isn ADD function isneq(upc,upc);
+ALTER EXTENSION isn ADD function isnge(upc,upc);
+ALTER EXTENSION isn ADD function isngt(upc,upc);
+ALTER EXTENSION isn ADD function isnne(upc,upc);
+ALTER EXTENSION isn ADD function isnlt(upc,ean13);
+ALTER EXTENSION isn ADD function isnle(upc,ean13);
+ALTER EXTENSION isn ADD function isneq(upc,ean13);
+ALTER EXTENSION isn ADD function isnge(upc,ean13);
+ALTER EXTENSION isn ADD function isngt(upc,ean13);
+ALTER EXTENSION isn ADD function isnne(upc,ean13);
+ALTER EXTENSION isn ADD operator >(ean13,ean13);
+ALTER EXTENSION isn ADD operator >=(ean13,ean13);
+ALTER EXTENSION isn ADD operator <(ean13,ean13);
+ALTER EXTENSION isn ADD operator <=(ean13,ean13);
+ALTER EXTENSION isn ADD operator <>(ean13,ean13);
+ALTER EXTENSION isn ADD operator =(ean13,ean13);
+ALTER EXTENSION isn ADD operator >(isbn13,ean13);
+ALTER EXTENSION isn ADD operator >=(ean13,isbn13);
+ALTER EXTENSION isn ADD operator <(ean13,isbn13);
+ALTER EXTENSION isn ADD operator >=(isbn13,ean13);
+ALTER EXTENSION isn ADD operator >(ean13,isbn13);
+ALTER EXTENSION isn ADD operator <=(ean13,isbn13);
+ALTER EXTENSION isn ADD operator =(isbn13,ean13);
+ALTER EXTENSION isn ADD operator <>(ean13,isbn13);
+ALTER EXTENSION isn ADD operator =(ean13,isbn13);
+ALTER EXTENSION isn ADD operator <=(isbn13,ean13);
+ALTER EXTENSION isn ADD operator <(isbn13,ean13);
+ALTER EXTENSION isn ADD operator <>(isbn13,ean13);
+ALTER EXTENSION isn ADD operator >(ismn13,ean13);
+ALTER EXTENSION isn ADD operator >=(ean13,ismn13);
+ALTER EXTENSION isn ADD operator <(ean13,ismn13);
+ALTER EXTENSION isn ADD operator >=(ismn13,ean13);
+ALTER EXTENSION isn ADD operator >(ean13,ismn13);
+ALTER EXTENSION isn ADD operator <=(ean13,ismn13);
+ALTER EXTENSION isn ADD operator =(ismn13,ean13);
+ALTER EXTENSION isn ADD operator <>(ean13,ismn13);
+ALTER EXTENSION isn ADD operator =(ean13,ismn13);
+ALTER EXTENSION isn ADD operator <=(ismn13,ean13);
+ALTER EXTENSION isn ADD operator <(ismn13,ean13);
+ALTER EXTENSION isn ADD operator <>(ismn13,ean13);
+ALTER EXTENSION isn ADD operator >(issn13,ean13);
+ALTER EXTENSION isn ADD operator >=(ean13,issn13);
+ALTER EXTENSION isn ADD operator <(ean13,issn13);
+ALTER EXTENSION isn ADD operator >=(issn13,ean13);
+ALTER EXTENSION isn ADD operator >(ean13,issn13);
+ALTER EXTENSION isn ADD operator <=(ean13,issn13);
+ALTER EXTENSION isn ADD operator =(issn13,ean13);
+ALTER EXTENSION isn ADD operator <>(ean13,issn13);
+ALTER EXTENSION isn ADD operator =(ean13,issn13);
+ALTER EXTENSION isn ADD operator <=(issn13,ean13);
+ALTER EXTENSION isn ADD operator <(issn13,ean13);
+ALTER EXTENSION isn ADD operator <>(issn13,ean13);
+ALTER EXTENSION isn ADD operator >(isbn,ean13);
+ALTER EXTENSION isn ADD operator >=(ean13,isbn);
+ALTER EXTENSION isn ADD operator <(ean13,isbn);
+ALTER EXTENSION isn ADD operator >=(isbn,ean13);
+ALTER EXTENSION isn ADD operator >(ean13,isbn);
+ALTER EXTENSION isn ADD operator <=(ean13,isbn);
+ALTER EXTENSION isn ADD operator =(isbn,ean13);
+ALTER EXTENSION isn ADD operator <>(ean13,isbn);
+ALTER EXTENSION isn ADD operator =(ean13,isbn);
+ALTER EXTENSION isn ADD operator <=(isbn,ean13);
+ALTER EXTENSION isn ADD operator <(isbn,ean13);
+ALTER EXTENSION isn ADD operator <>(isbn,ean13);
+ALTER EXTENSION isn ADD operator >(ismn,ean13);
+ALTER EXTENSION isn ADD operator >=(ean13,ismn);
+ALTER EXTENSION isn ADD operator <(ean13,ismn);
+ALTER EXTENSION isn ADD operator >=(ismn,ean13);
+ALTER EXTENSION isn ADD operator >(ean13,ismn);
+ALTER EXTENSION isn ADD operator <=(ean13,ismn);
+ALTER EXTENSION isn ADD operator =(ismn,ean13);
+ALTER EXTENSION isn ADD operator <>(ean13,ismn);
+ALTER EXTENSION isn ADD operator =(ean13,ismn);
+ALTER EXTENSION isn ADD operator <=(ismn,ean13);
+ALTER EXTENSION isn ADD operator <(ismn,ean13);
+ALTER EXTENSION isn ADD operator <>(ismn,ean13);
+ALTER EXTENSION isn ADD operator >(issn,ean13);
+ALTER EXTENSION isn ADD operator >=(ean13,issn);
+ALTER EXTENSION isn ADD operator <(ean13,issn);
+ALTER EXTENSION isn ADD operator >=(issn,ean13);
+ALTER EXTENSION isn ADD operator >(ean13,issn);
+ALTER EXTENSION isn ADD operator <=(ean13,issn);
+ALTER EXTENSION isn ADD operator =(issn,ean13);
+ALTER EXTENSION isn ADD operator <>(ean13,issn);
+ALTER EXTENSION isn ADD operator =(ean13,issn);
+ALTER EXTENSION isn ADD operator <=(issn,ean13);
+ALTER EXTENSION isn ADD operator <(issn,ean13);
+ALTER EXTENSION isn ADD operator <>(issn,ean13);
+ALTER EXTENSION isn ADD operator >(upc,ean13);
+ALTER EXTENSION isn ADD operator >=(ean13,upc);
+ALTER EXTENSION isn ADD operator <(ean13,upc);
+ALTER EXTENSION isn ADD operator >=(upc,ean13);
+ALTER EXTENSION isn ADD operator >(ean13,upc);
+ALTER EXTENSION isn ADD operator <=(ean13,upc);
+ALTER EXTENSION isn ADD operator =(upc,ean13);
+ALTER EXTENSION isn ADD operator <>(ean13,upc);
+ALTER EXTENSION isn ADD operator =(ean13,upc);
+ALTER EXTENSION isn ADD operator <=(upc,ean13);
+ALTER EXTENSION isn ADD operator <(upc,ean13);
+ALTER EXTENSION isn ADD operator <>(upc,ean13);
+ALTER EXTENSION isn ADD operator >(isbn13,isbn13);
+ALTER EXTENSION isn ADD operator >=(isbn13,isbn13);
+ALTER EXTENSION isn ADD operator <(isbn13,isbn13);
+ALTER EXTENSION isn ADD operator <=(isbn13,isbn13);
+ALTER EXTENSION isn ADD operator <>(isbn13,isbn13);
+ALTER EXTENSION isn ADD operator =(isbn13,isbn13);
+ALTER EXTENSION isn ADD operator >(isbn,isbn13);
+ALTER EXTENSION isn ADD operator >=(isbn13,isbn);
+ALTER EXTENSION isn ADD operator <(isbn13,isbn);
+ALTER EXTENSION isn ADD operator >=(isbn,isbn13);
+ALTER EXTENSION isn ADD operator >(isbn13,isbn);
+ALTER EXTENSION isn ADD operator <=(isbn13,isbn);
+ALTER EXTENSION isn ADD operator =(isbn,isbn13);
+ALTER EXTENSION isn ADD operator <>(isbn13,isbn);
+ALTER EXTENSION isn ADD operator =(isbn13,isbn);
+ALTER EXTENSION isn ADD operator <=(isbn,isbn13);
+ALTER EXTENSION isn ADD operator <(isbn,isbn13);
+ALTER EXTENSION isn ADD operator <>(isbn,isbn13);
+ALTER EXTENSION isn ADD operator >(isbn,isbn);
+ALTER EXTENSION isn ADD operator >=(isbn,isbn);
+ALTER EXTENSION isn ADD operator <(isbn,isbn);
+ALTER EXTENSION isn ADD operator <=(isbn,isbn);
+ALTER EXTENSION isn ADD operator <>(isbn,isbn);
+ALTER EXTENSION isn ADD operator =(isbn,isbn);
+ALTER EXTENSION isn ADD operator >(ismn13,ismn13);
+ALTER EXTENSION isn ADD operator >=(ismn13,ismn13);
+ALTER EXTENSION isn ADD operator <(ismn13,ismn13);
+ALTER EXTENSION isn ADD operator <=(ismn13,ismn13);
+ALTER EXTENSION isn ADD operator <>(ismn13,ismn13);
+ALTER EXTENSION isn ADD operator =(ismn13,ismn13);
+ALTER EXTENSION isn ADD operator >(ismn,ismn13);
+ALTER EXTENSION isn ADD operator >=(ismn13,ismn);
+ALTER EXTENSION isn ADD operator <(ismn13,ismn);
+ALTER EXTENSION isn ADD operator >=(ismn,ismn13);
+ALTER EXTENSION isn ADD operator >(ismn13,ismn);
+ALTER EXTENSION isn ADD operator <=(ismn13,ismn);
+ALTER EXTENSION isn ADD operator =(ismn,ismn13);
+ALTER EXTENSION isn ADD operator <>(ismn13,ismn);
+ALTER EXTENSION isn ADD operator =(ismn13,ismn);
+ALTER EXTENSION isn ADD operator <=(ismn,ismn13);
+ALTER EXTENSION isn ADD operator <(ismn,ismn13);
+ALTER EXTENSION isn ADD operator <>(ismn,ismn13);
+ALTER EXTENSION isn ADD operator >(ismn,ismn);
+ALTER EXTENSION isn ADD operator >=(ismn,ismn);
+ALTER EXTENSION isn ADD operator <(ismn,ismn);
+ALTER EXTENSION isn ADD operator <=(ismn,ismn);
+ALTER EXTENSION isn ADD operator <>(ismn,ismn);
+ALTER EXTENSION isn ADD operator =(ismn,ismn);
+ALTER EXTENSION isn ADD operator >(issn13,issn13);
+ALTER EXTENSION isn ADD operator >=(issn13,issn13);
+ALTER EXTENSION isn ADD operator <(issn13,issn13);
+ALTER EXTENSION isn ADD operator <=(issn13,issn13);
+ALTER EXTENSION isn ADD operator <>(issn13,issn13);
+ALTER EXTENSION isn ADD operator =(issn13,issn13);
+ALTER EXTENSION isn ADD operator >(issn,issn13);
+ALTER EXTENSION isn ADD operator >=(issn13,issn);
+ALTER EXTENSION isn ADD operator <(issn13,issn);
+ALTER EXTENSION isn ADD operator >=(issn,issn13);
+ALTER EXTENSION isn ADD operator >(issn13,issn);
+ALTER EXTENSION isn ADD operator <=(issn13,issn);
+ALTER EXTENSION isn ADD operator =(issn,issn13);
+ALTER EXTENSION isn ADD operator <>(issn13,issn);
+ALTER EXTENSION isn ADD operator =(issn13,issn);
+ALTER EXTENSION isn ADD operator <=(issn,issn13);
+ALTER EXTENSION isn ADD operator <(issn,issn13);
+ALTER EXTENSION isn ADD operator <>(issn,issn13);
+ALTER EXTENSION isn ADD operator >(issn,issn);
+ALTER EXTENSION isn ADD operator >=(issn,issn);
+ALTER EXTENSION isn ADD operator <(issn,issn);
+ALTER EXTENSION isn ADD operator <=(issn,issn);
+ALTER EXTENSION isn ADD operator <>(issn,issn);
+ALTER EXTENSION isn ADD operator =(issn,issn);
+ALTER EXTENSION isn ADD operator >(upc,upc);
+ALTER EXTENSION isn ADD operator >=(upc,upc);
+ALTER EXTENSION isn ADD operator <(upc,upc);
+ALTER EXTENSION isn ADD operator <=(upc,upc);
+ALTER EXTENSION isn ADD operator <>(upc,upc);
+ALTER EXTENSION isn ADD operator =(upc,upc);
+ALTER EXTENSION isn ADD operator family isn_ops using btree;
+ALTER EXTENSION isn ADD operator family isn_ops using hash;
+ALTER EXTENSION isn ADD function btean13cmp(ean13,ean13);
+ALTER EXTENSION isn ADD operator class ean13_ops using btree;
+ALTER EXTENSION isn ADD function hashean13(ean13);
+ALTER EXTENSION isn ADD operator class ean13_ops using hash;
+ALTER EXTENSION isn ADD function btean13cmp(ean13,isbn13);
+ALTER EXTENSION isn ADD function btean13cmp(ean13,ismn13);
+ALTER EXTENSION isn ADD function btean13cmp(ean13,issn13);
+ALTER EXTENSION isn ADD function btean13cmp(ean13,isbn);
+ALTER EXTENSION isn ADD function btean13cmp(ean13,ismn);
+ALTER EXTENSION isn ADD function btean13cmp(ean13,issn);
+ALTER EXTENSION isn ADD function btean13cmp(ean13,upc);
+ALTER EXTENSION isn ADD function btisbn13cmp(isbn13,isbn13);
+ALTER EXTENSION isn ADD operator class isbn13_ops using btree;
+ALTER EXTENSION isn ADD function hashisbn13(isbn13);
+ALTER EXTENSION isn ADD operator class isbn13_ops using hash;
+ALTER EXTENSION isn ADD function btisbn13cmp(isbn13,ean13);
+ALTER EXTENSION isn ADD function btisbn13cmp(isbn13,isbn);
+ALTER EXTENSION isn ADD function btisbncmp(isbn,isbn);
+ALTER EXTENSION isn ADD operator class isbn_ops using btree;
+ALTER EXTENSION isn ADD function hashisbn(isbn);
+ALTER EXTENSION isn ADD operator class isbn_ops using hash;
+ALTER EXTENSION isn ADD function btisbncmp(isbn,ean13);
+ALTER EXTENSION isn ADD function btisbncmp(isbn,isbn13);
+ALTER EXTENSION isn ADD function btismn13cmp(ismn13,ismn13);
+ALTER EXTENSION isn ADD operator class ismn13_ops using btree;
+ALTER EXTENSION isn ADD function hashismn13(ismn13);
+ALTER EXTENSION isn ADD operator class ismn13_ops using hash;
+ALTER EXTENSION isn ADD function btismn13cmp(ismn13,ean13);
+ALTER EXTENSION isn ADD function btismn13cmp(ismn13,ismn);
+ALTER EXTENSION isn ADD function btismncmp(ismn,ismn);
+ALTER EXTENSION isn ADD operator class ismn_ops using btree;
+ALTER EXTENSION isn ADD function hashismn(ismn);
+ALTER EXTENSION isn ADD operator class ismn_ops using hash;
+ALTER EXTENSION isn ADD function btismncmp(ismn,ean13);
+ALTER EXTENSION isn ADD function btismncmp(ismn,ismn13);
+ALTER EXTENSION isn ADD function btissn13cmp(issn13,issn13);
+ALTER EXTENSION isn ADD operator class issn13_ops using btree;
+ALTER EXTENSION isn ADD function hashissn13(issn13);
+ALTER EXTENSION isn ADD operator class issn13_ops using hash;
+ALTER EXTENSION isn ADD function btissn13cmp(issn13,ean13);
+ALTER EXTENSION isn ADD function btissn13cmp(issn13,issn);
+ALTER EXTENSION isn ADD function btissncmp(issn,issn);
+ALTER EXTENSION isn ADD operator class issn_ops using btree;
+ALTER EXTENSION isn ADD function hashissn(issn);
+ALTER EXTENSION isn ADD operator class issn_ops using hash;
+ALTER EXTENSION isn ADD function btissncmp(issn,ean13);
+ALTER EXTENSION isn ADD function btissncmp(issn,issn13);
+ALTER EXTENSION isn ADD function btupccmp(upc,upc);
+ALTER EXTENSION isn ADD operator class upc_ops using btree;
+ALTER EXTENSION isn ADD function hashupc(upc);
+ALTER EXTENSION isn ADD operator class upc_ops using hash;
+ALTER EXTENSION isn ADD function btupccmp(upc,ean13);
+ALTER EXTENSION isn ADD function isbn13(ean13);
+ALTER EXTENSION isn ADD function ismn13(ean13);
+ALTER EXTENSION isn ADD function issn13(ean13);
+ALTER EXTENSION isn ADD function isbn(ean13);
+ALTER EXTENSION isn ADD function ismn(ean13);
+ALTER EXTENSION isn ADD function issn(ean13);
+ALTER EXTENSION isn ADD function upc(ean13);
+ALTER EXTENSION isn ADD cast (ean13 as isbn13);
+ALTER EXTENSION isn ADD cast (ean13 as isbn);
+ALTER EXTENSION isn ADD cast (ean13 as ismn13);
+ALTER EXTENSION isn ADD cast (ean13 as ismn);
+ALTER EXTENSION isn ADD cast (ean13 as issn13);
+ALTER EXTENSION isn ADD cast (ean13 as issn);
+ALTER EXTENSION isn ADD cast (ean13 as upc);
+ALTER EXTENSION isn ADD cast (isbn13 as ean13);
+ALTER EXTENSION isn ADD cast (isbn as ean13);
+ALTER EXTENSION isn ADD cast (ismn13 as ean13);
+ALTER EXTENSION isn ADD cast (ismn as ean13);
+ALTER EXTENSION isn ADD cast (issn13 as ean13);
+ALTER EXTENSION isn ADD cast (issn as ean13);
+ALTER EXTENSION isn ADD cast (upc as ean13);
+ALTER EXTENSION isn ADD cast (isbn as isbn13);
+ALTER EXTENSION isn ADD cast (isbn13 as isbn);
+ALTER EXTENSION isn ADD cast (ismn as ismn13);
+ALTER EXTENSION isn ADD cast (ismn13 as ismn);
+ALTER EXTENSION isn ADD cast (issn as issn13);
+ALTER EXTENSION isn ADD cast (issn13 as issn);
+ALTER EXTENSION isn ADD function make_valid(ean13);
+ALTER EXTENSION isn ADD function make_valid(isbn13);
+ALTER EXTENSION isn ADD function make_valid(ismn13);
+ALTER EXTENSION isn ADD function make_valid(issn13);
+ALTER EXTENSION isn ADD function make_valid(isbn);
+ALTER EXTENSION isn ADD function make_valid(ismn);
+ALTER EXTENSION isn ADD function make_valid(issn);
+ALTER EXTENSION isn ADD function make_valid(upc);
+ALTER EXTENSION isn ADD function is_valid(ean13);
+ALTER EXTENSION isn ADD function is_valid(isbn13);
+ALTER EXTENSION isn ADD function is_valid(ismn13);
+ALTER EXTENSION isn ADD function is_valid(issn13);
+ALTER EXTENSION isn ADD function is_valid(isbn);
+ALTER EXTENSION isn ADD function is_valid(ismn);
+ALTER EXTENSION isn ADD function is_valid(issn);
+ALTER EXTENSION isn ADD function is_valid(upc);
+ALTER EXTENSION isn ADD function isn_weak(boolean);
+ALTER EXTENSION isn ADD function isn_weak();
diff --git a/contrib/isn/isn.control b/contrib/isn/isn.control
new file mode 100644
index 0000000000..cf0b2ebe38
--- /dev/null
+++ b/contrib/isn/isn.control
@@ -0,0 +1,5 @@
+# isn extension
+comment = 'data types for international product numbering standards'
+default_version = '1.0'
+module_pathname = '$libdir/isn'
+relocatable = true
diff --git a/contrib/isn/uninstall_isn.sql b/contrib/isn/uninstall_isn.sql
deleted file mode 100644
index bf866b4748..0000000000
--- a/contrib/isn/uninstall_isn.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-/* contrib/isn/uninstall_isn.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
--- Drop the operator families (which don't depend on the types)
-DROP OPERATOR FAMILY isn_ops USING btree CASCADE;
-DROP OPERATOR FAMILY isn_ops USING hash CASCADE;
-
---
--- Drop the actual types (in cascade):
---
-DROP TYPE ean13 CASCADE;
-DROP TYPE isbn13 CASCADE;
-DROP TYPE ismn13 CASCADE;
-DROP TYPE issn13 CASCADE;
-DROP TYPE isbn CASCADE;
-DROP TYPE ismn CASCADE;
-DROP TYPE issn CASCADE;
-DROP TYPE upc CASCADE;
-
--- and clean up a couple miscellaneous functions
-DROP FUNCTION isn_weak();
-DROP FUNCTION isn_weak(boolean);
diff --git a/contrib/lo/.gitignore b/contrib/lo/.gitignore
deleted file mode 100644
index 979347bd00..0000000000
--- a/contrib/lo/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/lo.sql
diff --git a/contrib/lo/Makefile b/contrib/lo/Makefile
index 43c01f57c0..66b337c17a 100644
--- a/contrib/lo/Makefile
+++ b/contrib/lo/Makefile
@@ -1,8 +1,9 @@
# contrib/lo/Makefile
MODULES = lo
-DATA_built = lo.sql
-DATA = uninstall_lo.sql
+
+EXTENSION = lo
+DATA = lo--1.0.sql lo--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/lo/lo.sql.in b/contrib/lo/lo--1.0.sql
index 8c7afbe5e3..6ecb370a22 100644
--- a/contrib/lo/lo.sql.in
+++ b/contrib/lo/lo--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/lo/lo.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/lo/lo--1.0.sql */
--
-- Create the data type ... now just a domain over OID
diff --git a/contrib/lo/lo--unpackaged--1.0.sql b/contrib/lo/lo--unpackaged--1.0.sql
new file mode 100644
index 0000000000..54de61686e
--- /dev/null
+++ b/contrib/lo/lo--unpackaged--1.0.sql
@@ -0,0 +1,5 @@
+/* contrib/lo/lo--unpackaged--1.0.sql */
+
+ALTER EXTENSION lo ADD domain lo;
+ALTER EXTENSION lo ADD function lo_oid(lo);
+ALTER EXTENSION lo ADD function lo_manage();
diff --git a/contrib/lo/lo.control b/contrib/lo/lo.control
new file mode 100644
index 0000000000..849dfb5803
--- /dev/null
+++ b/contrib/lo/lo.control
@@ -0,0 +1,5 @@
+# lo extension
+comment = 'Large Object maintenance'
+default_version = '1.0'
+module_pathname = '$libdir/lo'
+relocatable = true
diff --git a/contrib/lo/uninstall_lo.sql b/contrib/lo/uninstall_lo.sql
deleted file mode 100644
index 77deb1d550..0000000000
--- a/contrib/lo/uninstall_lo.sql
+++ /dev/null
@@ -1,17 +0,0 @@
-/* contrib/lo/uninstall_lo.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
---
--- This removes the LO type
--- It's used just for development
---
-
--- drop the type and associated functions
-DROP TYPE lo CASCADE;
-
--- the trigger function has no dependency on the type, so drop separately
-DROP FUNCTION lo_manage();
-
--- the lo stuff is now removed from the system
diff --git a/contrib/ltree/.gitignore b/contrib/ltree/.gitignore
index 49883e82a3..19b6c5ba42 100644
--- a/contrib/ltree/.gitignore
+++ b/contrib/ltree/.gitignore
@@ -1,3 +1,2 @@
-/ltree.sql
# Generated subdirectories
/results/
diff --git a/contrib/ltree/Makefile b/contrib/ltree/Makefile
index bad3cbfe85..65d42f875f 100644
--- a/contrib/ltree/Makefile
+++ b/contrib/ltree/Makefile
@@ -1,11 +1,13 @@
# contrib/ltree/Makefile
-PG_CPPFLAGS = -DLOWER_NODE
MODULE_big = ltree
OBJS = ltree_io.o ltree_op.o lquery_op.o _ltree_op.o crc32.o \
ltxtquery_io.o ltxtquery_op.o ltree_gist.o _ltree_gist.o
-DATA_built = ltree.sql
-DATA = uninstall_ltree.sql
+PG_CPPFLAGS = -DLOWER_NODE
+
+EXTENSION = ltree
+DATA = ltree--1.0.sql ltree--unpackaged--1.0.sql
+
REGRESS = ltree
ifdef USE_PGXS
diff --git a/contrib/ltree/expected/ltree.out b/contrib/ltree/expected/ltree.out
index 7f61e569cf..da6e39a785 100644
--- a/contrib/ltree/expected/ltree.out
+++ b/contrib/ltree/expected/ltree.out
@@ -1,10 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of ltree.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION ltree;
SELECT ''::ltree;
ltree
-------
diff --git a/contrib/ltree/ltree.sql.in b/contrib/ltree/ltree--1.0.sql
index 1b985a7a99..d9b5ead53a 100644
--- a/contrib/ltree/ltree.sql.in
+++ b/contrib/ltree/ltree--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/ltree/ltree.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/ltree/ltree--1.0.sql */
CREATE OR REPLACE FUNCTION ltree_in(cstring)
RETURNS ltree
diff --git a/contrib/ltree/ltree--unpackaged--1.0.sql b/contrib/ltree/ltree--unpackaged--1.0.sql
new file mode 100644
index 0000000000..f483725b4a
--- /dev/null
+++ b/contrib/ltree/ltree--unpackaged--1.0.sql
@@ -0,0 +1,131 @@
+/* contrib/ltree/ltree--unpackaged--1.0.sql */
+
+ALTER EXTENSION ltree ADD type ltree;
+ALTER EXTENSION ltree ADD function ltree_in(cstring);
+ALTER EXTENSION ltree ADD function ltree_out(ltree);
+ALTER EXTENSION ltree ADD function ltree_cmp(ltree,ltree);
+ALTER EXTENSION ltree ADD function ltree_lt(ltree,ltree);
+ALTER EXTENSION ltree ADD function ltree_le(ltree,ltree);
+ALTER EXTENSION ltree ADD function ltree_eq(ltree,ltree);
+ALTER EXTENSION ltree ADD function ltree_ge(ltree,ltree);
+ALTER EXTENSION ltree ADD function ltree_gt(ltree,ltree);
+ALTER EXTENSION ltree ADD function ltree_ne(ltree,ltree);
+ALTER EXTENSION ltree ADD operator >(ltree,ltree);
+ALTER EXTENSION ltree ADD operator >=(ltree,ltree);
+ALTER EXTENSION ltree ADD operator <(ltree,ltree);
+ALTER EXTENSION ltree ADD operator <=(ltree,ltree);
+ALTER EXTENSION ltree ADD operator <>(ltree,ltree);
+ALTER EXTENSION ltree ADD operator =(ltree,ltree);
+ALTER EXTENSION ltree ADD function subltree(ltree,integer,integer);
+ALTER EXTENSION ltree ADD function subpath(ltree,integer,integer);
+ALTER EXTENSION ltree ADD function subpath(ltree,integer);
+ALTER EXTENSION ltree ADD function index(ltree,ltree);
+ALTER EXTENSION ltree ADD function index(ltree,ltree,integer);
+ALTER EXTENSION ltree ADD function nlevel(ltree);
+ALTER EXTENSION ltree ADD function ltree2text(ltree);
+ALTER EXTENSION ltree ADD function text2ltree(text);
+ALTER EXTENSION ltree ADD function lca(ltree[]);
+ALTER EXTENSION ltree ADD function lca(ltree,ltree);
+ALTER EXTENSION ltree ADD function lca(ltree,ltree,ltree);
+ALTER EXTENSION ltree ADD function lca(ltree,ltree,ltree,ltree);
+ALTER EXTENSION ltree ADD function lca(ltree,ltree,ltree,ltree,ltree);
+ALTER EXTENSION ltree ADD function lca(ltree,ltree,ltree,ltree,ltree,ltree);
+ALTER EXTENSION ltree ADD function lca(ltree,ltree,ltree,ltree,ltree,ltree,ltree);
+ALTER EXTENSION ltree ADD function lca(ltree,ltree,ltree,ltree,ltree,ltree,ltree,ltree);
+ALTER EXTENSION ltree ADD function ltree_isparent(ltree,ltree);
+ALTER EXTENSION ltree ADD function ltree_risparent(ltree,ltree);
+ALTER EXTENSION ltree ADD function ltree_addltree(ltree,ltree);
+ALTER EXTENSION ltree ADD function ltree_addtext(ltree,text);
+ALTER EXTENSION ltree ADD function ltree_textadd(text,ltree);
+ALTER EXTENSION ltree ADD function ltreeparentsel(internal,oid,internal,integer);
+ALTER EXTENSION ltree ADD operator <@(ltree,ltree);
+ALTER EXTENSION ltree ADD operator @>(ltree,ltree);
+ALTER EXTENSION ltree ADD operator ^<@(ltree,ltree);
+ALTER EXTENSION ltree ADD operator ^@>(ltree,ltree);
+ALTER EXTENSION ltree ADD operator ||(ltree,ltree);
+ALTER EXTENSION ltree ADD operator ||(ltree,text);
+ALTER EXTENSION ltree ADD operator ||(text,ltree);
+ALTER EXTENSION ltree ADD operator family ltree_ops using btree;
+ALTER EXTENSION ltree ADD operator class ltree_ops using btree;
+ALTER EXTENSION ltree ADD type lquery;
+ALTER EXTENSION ltree ADD function lquery_in(cstring);
+ALTER EXTENSION ltree ADD function lquery_out(lquery);
+ALTER EXTENSION ltree ADD function ltq_regex(ltree,lquery);
+ALTER EXTENSION ltree ADD function ltq_rregex(lquery,ltree);
+ALTER EXTENSION ltree ADD operator ~(lquery,ltree);
+ALTER EXTENSION ltree ADD operator ~(ltree,lquery);
+ALTER EXTENSION ltree ADD operator ^~(lquery,ltree);
+ALTER EXTENSION ltree ADD operator ^~(ltree,lquery);
+ALTER EXTENSION ltree ADD function lt_q_regex(ltree,lquery[]);
+ALTER EXTENSION ltree ADD function lt_q_rregex(lquery[],ltree);
+ALTER EXTENSION ltree ADD operator ?(lquery[],ltree);
+ALTER EXTENSION ltree ADD operator ?(ltree,lquery[]);
+ALTER EXTENSION ltree ADD operator ^?(lquery[],ltree);
+ALTER EXTENSION ltree ADD operator ^?(ltree,lquery[]);
+ALTER EXTENSION ltree ADD type ltxtquery;
+ALTER EXTENSION ltree ADD function ltxtq_in(cstring);
+ALTER EXTENSION ltree ADD function ltxtq_out(ltxtquery);
+ALTER EXTENSION ltree ADD function ltxtq_exec(ltree,ltxtquery);
+ALTER EXTENSION ltree ADD function ltxtq_rexec(ltxtquery,ltree);
+ALTER EXTENSION ltree ADD operator @(ltxtquery,ltree);
+ALTER EXTENSION ltree ADD operator @(ltree,ltxtquery);
+ALTER EXTENSION ltree ADD operator ^@(ltxtquery,ltree);
+ALTER EXTENSION ltree ADD operator ^@(ltree,ltxtquery);
+ALTER EXTENSION ltree ADD type ltree_gist;
+ALTER EXTENSION ltree ADD function ltree_gist_in(cstring);
+ALTER EXTENSION ltree ADD function ltree_gist_out(ltree_gist);
+ALTER EXTENSION ltree ADD function ltree_consistent(internal,internal,smallint,oid,internal);
+ALTER EXTENSION ltree ADD function ltree_compress(internal);
+ALTER EXTENSION ltree ADD function ltree_decompress(internal);
+ALTER EXTENSION ltree ADD function ltree_penalty(internal,internal,internal);
+ALTER EXTENSION ltree ADD function ltree_picksplit(internal,internal);
+ALTER EXTENSION ltree ADD function ltree_union(internal,internal);
+ALTER EXTENSION ltree ADD function ltree_same(internal,internal,internal);
+ALTER EXTENSION ltree ADD operator family gist_ltree_ops using gist;
+ALTER EXTENSION ltree ADD operator class gist_ltree_ops using gist;
+ALTER EXTENSION ltree ADD function _ltree_isparent(ltree[],ltree);
+ALTER EXTENSION ltree ADD function _ltree_r_isparent(ltree,ltree[]);
+ALTER EXTENSION ltree ADD function _ltree_risparent(ltree[],ltree);
+ALTER EXTENSION ltree ADD function _ltree_r_risparent(ltree,ltree[]);
+ALTER EXTENSION ltree ADD function _ltq_regex(ltree[],lquery);
+ALTER EXTENSION ltree ADD function _ltq_rregex(lquery,ltree[]);
+ALTER EXTENSION ltree ADD function _lt_q_regex(ltree[],lquery[]);
+ALTER EXTENSION ltree ADD function _lt_q_rregex(lquery[],ltree[]);
+ALTER EXTENSION ltree ADD function _ltxtq_exec(ltree[],ltxtquery);
+ALTER EXTENSION ltree ADD function _ltxtq_rexec(ltxtquery,ltree[]);
+ALTER EXTENSION ltree ADD operator <@(ltree,ltree[]);
+ALTER EXTENSION ltree ADD operator @>(ltree[],ltree);
+ALTER EXTENSION ltree ADD operator @>(ltree,ltree[]);
+ALTER EXTENSION ltree ADD operator <@(ltree[],ltree);
+ALTER EXTENSION ltree ADD operator ~(lquery,ltree[]);
+ALTER EXTENSION ltree ADD operator ~(ltree[],lquery);
+ALTER EXTENSION ltree ADD operator ?(lquery[],ltree[]);
+ALTER EXTENSION ltree ADD operator ?(ltree[],lquery[]);
+ALTER EXTENSION ltree ADD operator @(ltxtquery,ltree[]);
+ALTER EXTENSION ltree ADD operator @(ltree[],ltxtquery);
+ALTER EXTENSION ltree ADD operator ^<@(ltree,ltree[]);
+ALTER EXTENSION ltree ADD operator ^@>(ltree[],ltree);
+ALTER EXTENSION ltree ADD operator ^@>(ltree,ltree[]);
+ALTER EXTENSION ltree ADD operator ^<@(ltree[],ltree);
+ALTER EXTENSION ltree ADD operator ^~(lquery,ltree[]);
+ALTER EXTENSION ltree ADD operator ^~(ltree[],lquery);
+ALTER EXTENSION ltree ADD operator ^?(lquery[],ltree[]);
+ALTER EXTENSION ltree ADD operator ^?(ltree[],lquery[]);
+ALTER EXTENSION ltree ADD operator ^@(ltxtquery,ltree[]);
+ALTER EXTENSION ltree ADD operator ^@(ltree[],ltxtquery);
+ALTER EXTENSION ltree ADD function _ltree_extract_isparent(ltree[],ltree);
+ALTER EXTENSION ltree ADD operator ?@>(ltree[],ltree);
+ALTER EXTENSION ltree ADD function _ltree_extract_risparent(ltree[],ltree);
+ALTER EXTENSION ltree ADD operator ?<@(ltree[],ltree);
+ALTER EXTENSION ltree ADD function _ltq_extract_regex(ltree[],lquery);
+ALTER EXTENSION ltree ADD operator ?~(ltree[],lquery);
+ALTER EXTENSION ltree ADD function _ltxtq_extract_exec(ltree[],ltxtquery);
+ALTER EXTENSION ltree ADD operator ?@(ltree[],ltxtquery);
+ALTER EXTENSION ltree ADD function _ltree_consistent(internal,internal,smallint,oid,internal);
+ALTER EXTENSION ltree ADD function _ltree_compress(internal);
+ALTER EXTENSION ltree ADD function _ltree_penalty(internal,internal,internal);
+ALTER EXTENSION ltree ADD function _ltree_picksplit(internal,internal);
+ALTER EXTENSION ltree ADD function _ltree_union(internal,internal);
+ALTER EXTENSION ltree ADD function _ltree_same(internal,internal,internal);
+ALTER EXTENSION ltree ADD operator family gist__ltree_ops using gist;
+ALTER EXTENSION ltree ADD operator class gist__ltree_ops using gist;
diff --git a/contrib/ltree/ltree.control b/contrib/ltree/ltree.control
new file mode 100644
index 0000000000..d879fd618c
--- /dev/null
+++ b/contrib/ltree/ltree.control
@@ -0,0 +1,5 @@
+# ltree extension
+comment = 'data type for hierarchical tree-like structures'
+default_version = '1.0'
+module_pathname = '$libdir/ltree'
+relocatable = true
diff --git a/contrib/ltree/sql/ltree.sql b/contrib/ltree/sql/ltree.sql
index 50aad78d3c..46cfa41a41 100644
--- a/contrib/ltree/sql/ltree.sql
+++ b/contrib/ltree/sql/ltree.sql
@@ -1,12 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of ltree.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i ltree.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION ltree;
SELECT ''::ltree;
SELECT '1'::ltree;
diff --git a/contrib/ltree/uninstall_ltree.sql b/contrib/ltree/uninstall_ltree.sql
deleted file mode 100644
index 2e10b10e97..0000000000
--- a/contrib/ltree/uninstall_ltree.sql
+++ /dev/null
@@ -1,240 +0,0 @@
-/* contrib/ltree/uninstall_ltree.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP OPERATOR CLASS gist__ltree_ops USING gist;
-
-DROP FUNCTION _ltree_same(internal, internal, internal);
-
-DROP FUNCTION _ltree_union(internal, internal);
-
-DROP FUNCTION _ltree_picksplit(internal, internal);
-
-DROP FUNCTION _ltree_penalty(internal,internal,internal);
-
-DROP FUNCTION _ltree_compress(internal);
-
-DROP FUNCTION _ltree_consistent(internal,internal,int2,oid,internal);
-
-DROP OPERATOR ?@ (_ltree, ltxtquery);
-
-DROP FUNCTION _ltxtq_extract_exec(_ltree,ltxtquery);
-
-DROP OPERATOR ?~ (_ltree, lquery);
-
-DROP FUNCTION _ltq_extract_regex(_ltree,lquery);
-
-DROP OPERATOR ?<@ (_ltree, ltree);
-
-DROP FUNCTION _ltree_extract_risparent(_ltree,ltree);
-
-DROP OPERATOR ?@> (_ltree, ltree);
-
-DROP FUNCTION _ltree_extract_isparent(_ltree,ltree);
-
-DROP OPERATOR ^@ (ltxtquery, _ltree);
-
-DROP OPERATOR ^@ (_ltree, ltxtquery);
-
-DROP OPERATOR ^? (_lquery, _ltree);
-
-DROP OPERATOR ^? (_ltree, _lquery);
-
-DROP OPERATOR ^~ (lquery, _ltree);
-
-DROP OPERATOR ^~ (_ltree, lquery);
-
-DROP OPERATOR ^@> (ltree, _ltree);
-
-DROP OPERATOR ^<@ (_ltree, ltree);
-
-DROP OPERATOR ^<@ (ltree, _ltree);
-
-DROP OPERATOR ^@> (_ltree, ltree);
-
-DROP OPERATOR @ (ltxtquery, _ltree);
-
-DROP OPERATOR @ (_ltree, ltxtquery);
-
-DROP OPERATOR ? (_lquery, _ltree);
-
-DROP OPERATOR ? (_ltree, _lquery);
-
-DROP OPERATOR ~ (lquery, _ltree);
-
-DROP OPERATOR ~ (_ltree, lquery);
-
-DROP OPERATOR @> (ltree, _ltree);
-
-DROP OPERATOR <@ (_ltree, ltree);
-
-DROP OPERATOR <@ (ltree, _ltree);
-
-DROP OPERATOR @> (_ltree, ltree);
-
-DROP FUNCTION _ltxtq_rexec(ltxtquery, _ltree);
-
-DROP FUNCTION _ltxtq_exec(_ltree, ltxtquery);
-
-DROP FUNCTION _lt_q_rregex(_lquery,_ltree);
-
-DROP FUNCTION _lt_q_regex(_ltree,_lquery);
-
-DROP FUNCTION _ltq_rregex(lquery,_ltree);
-
-DROP FUNCTION _ltq_regex(_ltree,lquery);
-
-DROP FUNCTION _ltree_r_risparent(ltree,_ltree);
-
-DROP FUNCTION _ltree_risparent(_ltree,ltree);
-
-DROP FUNCTION _ltree_r_isparent(ltree,_ltree);
-
-DROP FUNCTION _ltree_isparent(_ltree,ltree);
-
-DROP OPERATOR CLASS gist_ltree_ops USING gist;
-
-DROP FUNCTION ltree_same(internal, internal, internal);
-
-DROP FUNCTION ltree_union(internal, internal);
-
-DROP FUNCTION ltree_picksplit(internal, internal);
-
-DROP FUNCTION ltree_penalty(internal,internal,internal);
-
-DROP FUNCTION ltree_decompress(internal);
-
-DROP FUNCTION ltree_compress(internal);
-
-DROP FUNCTION ltree_consistent(internal,internal,int2,oid,internal);
-
-DROP TYPE ltree_gist CASCADE;
-
-DROP OPERATOR ^@ (ltxtquery, ltree);
-
-DROP OPERATOR ^@ (ltree, ltxtquery);
-
-DROP OPERATOR @ (ltxtquery, ltree);
-
-DROP OPERATOR @ (ltree, ltxtquery);
-
-DROP FUNCTION ltxtq_rexec(ltxtquery, ltree);
-
-DROP FUNCTION ltxtq_exec(ltree, ltxtquery);
-
-DROP TYPE ltxtquery CASCADE;
-
-DROP OPERATOR ^? (_lquery, ltree);
-
-DROP OPERATOR ^? (ltree, _lquery);
-
-DROP OPERATOR ? (_lquery, ltree);
-
-DROP OPERATOR ? (ltree, _lquery);
-
-DROP FUNCTION lt_q_rregex(_lquery,ltree);
-
-DROP FUNCTION lt_q_regex(ltree,_lquery);
-
-DROP OPERATOR ^~ (lquery, ltree);
-
-DROP OPERATOR ^~ (ltree, lquery);
-
-DROP OPERATOR ~ (lquery, ltree);
-
-DROP OPERATOR ~ (ltree, lquery);
-
-DROP FUNCTION ltq_rregex(lquery,ltree);
-
-DROP FUNCTION ltq_regex(ltree,lquery);
-
-DROP TYPE lquery CASCADE;
-
-DROP OPERATOR CLASS ltree_ops USING btree;
-
-DROP OPERATOR || (text, ltree);
-
-DROP OPERATOR || (ltree, text);
-
-DROP OPERATOR || (ltree, ltree);
-
-DROP OPERATOR ^<@ (ltree, ltree);
-
-DROP OPERATOR <@ (ltree, ltree);
-
-DROP OPERATOR ^@> (ltree, ltree);
-
-DROP OPERATOR @> (ltree, ltree);
-
-DROP FUNCTION ltreeparentsel(internal, oid, internal, integer);
-
-DROP FUNCTION ltree_textadd(text,ltree);
-
-DROP FUNCTION ltree_addtext(ltree,text);
-
-DROP FUNCTION ltree_addltree(ltree,ltree);
-
-DROP FUNCTION ltree_risparent(ltree,ltree);
-
-DROP FUNCTION ltree_isparent(ltree,ltree);
-
-DROP FUNCTION lca(ltree,ltree,ltree,ltree,ltree,ltree,ltree,ltree);
-
-DROP FUNCTION lca(ltree,ltree,ltree,ltree,ltree,ltree,ltree);
-
-DROP FUNCTION lca(ltree,ltree,ltree,ltree,ltree,ltree);
-
-DROP FUNCTION lca(ltree,ltree,ltree,ltree,ltree);
-
-DROP FUNCTION lca(ltree,ltree,ltree,ltree);
-
-DROP FUNCTION lca(ltree,ltree,ltree);
-
-DROP FUNCTION lca(ltree,ltree);
-
-DROP FUNCTION lca(_ltree);
-
-DROP FUNCTION text2ltree(text);
-
-DROP FUNCTION ltree2text(ltree);
-
-DROP FUNCTION nlevel(ltree);
-
-DROP FUNCTION index(ltree,ltree,int4);
-
-DROP FUNCTION index(ltree,ltree);
-
-DROP FUNCTION subpath(ltree,int4);
-
-DROP FUNCTION subpath(ltree,int4,int4);
-
-DROP FUNCTION subltree(ltree,int4,int4);
-
-DROP OPERATOR <> (ltree, ltree);
-
-DROP OPERATOR = (ltree, ltree);
-
-DROP OPERATOR > (ltree, ltree);
-
-DROP OPERATOR >= (ltree, ltree);
-
-DROP OPERATOR <= (ltree, ltree);
-
-DROP OPERATOR < (ltree, ltree);
-
-DROP FUNCTION ltree_ne(ltree,ltree);
-
-DROP FUNCTION ltree_gt(ltree,ltree);
-
-DROP FUNCTION ltree_ge(ltree,ltree);
-
-DROP FUNCTION ltree_eq(ltree,ltree);
-
-DROP FUNCTION ltree_le(ltree,ltree);
-
-DROP FUNCTION ltree_lt(ltree,ltree);
-
-DROP FUNCTION ltree_cmp(ltree,ltree);
-
-DROP TYPE ltree CASCADE;
diff --git a/contrib/pageinspect/.gitignore b/contrib/pageinspect/.gitignore
deleted file mode 100644
index fad166aaee..0000000000
--- a/contrib/pageinspect/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/pageinspect.sql
diff --git a/contrib/pageinspect/Makefile b/contrib/pageinspect/Makefile
index a8ae51dfd1..13ba6d3911 100644
--- a/contrib/pageinspect/Makefile
+++ b/contrib/pageinspect/Makefile
@@ -1,15 +1,10 @@
-#-------------------------------------------------------------------------
-#
-# pageinspect Makefile
-#
# contrib/pageinspect/Makefile
-#
-#-------------------------------------------------------------------------
MODULE_big = pageinspect
OBJS = rawpage.o heapfuncs.o btreefuncs.o fsmfuncs.o
-DATA_built = pageinspect.sql
-DATA = uninstall_pageinspect.sql
+
+EXTENSION = pageinspect
+DATA = pageinspect--1.0.sql pageinspect--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/pageinspect/pageinspect.sql.in b/contrib/pageinspect/pageinspect--1.0.sql
index d6058d409f..b6e46063ba 100644
--- a/contrib/pageinspect/pageinspect.sql.in
+++ b/contrib/pageinspect/pageinspect--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/pageinspect/pageinspect.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/pageinspect/pageinspect--1.0.sql */
--
-- get_raw_page()
diff --git a/contrib/pageinspect/pageinspect--unpackaged--1.0.sql b/contrib/pageinspect/pageinspect--unpackaged--1.0.sql
new file mode 100644
index 0000000000..a9d1b52a42
--- /dev/null
+++ b/contrib/pageinspect/pageinspect--unpackaged--1.0.sql
@@ -0,0 +1,10 @@
+/* contrib/pageinspect/pageinspect--unpackaged--1.0.sql */
+
+ALTER EXTENSION pageinspect ADD function get_raw_page(text,integer);
+ALTER EXTENSION pageinspect ADD function get_raw_page(text,text,integer);
+ALTER EXTENSION pageinspect ADD function page_header(bytea);
+ALTER EXTENSION pageinspect ADD function heap_page_items(bytea);
+ALTER EXTENSION pageinspect ADD function bt_metap(text);
+ALTER EXTENSION pageinspect ADD function bt_page_stats(text,integer);
+ALTER EXTENSION pageinspect ADD function bt_page_items(text,integer);
+ALTER EXTENSION pageinspect ADD function fsm_page_contents(bytea);
diff --git a/contrib/pageinspect/pageinspect.control b/contrib/pageinspect/pageinspect.control
new file mode 100644
index 0000000000..f9da0e86ed
--- /dev/null
+++ b/contrib/pageinspect/pageinspect.control
@@ -0,0 +1,5 @@
+# pageinspect extension
+comment = 'inspect the contents of database pages at a low level'
+default_version = '1.0'
+module_pathname = '$libdir/pageinspect'
+relocatable = true
diff --git a/contrib/pageinspect/uninstall_pageinspect.sql b/contrib/pageinspect/uninstall_pageinspect.sql
deleted file mode 100644
index a980fd7d01..0000000000
--- a/contrib/pageinspect/uninstall_pageinspect.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-/* contrib/pageinspect/uninstall_pageinspect.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION get_raw_page(text, int4);
-DROP FUNCTION get_raw_page(text, text, int4);
-DROP FUNCTION page_header(bytea);
-DROP FUNCTION heap_page_items(bytea);
-DROP FUNCTION bt_metap(text);
-DROP FUNCTION bt_page_stats(text, int4);
-DROP FUNCTION bt_page_items(text, int4);
-DROP FUNCTION fsm_page_contents(bytea);
diff --git a/contrib/pg_buffercache/.gitignore b/contrib/pg_buffercache/.gitignore
deleted file mode 100644
index fea8b0b3d4..0000000000
--- a/contrib/pg_buffercache/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/pg_buffercache.sql
diff --git a/contrib/pg_buffercache/Makefile b/contrib/pg_buffercache/Makefile
index ffcf0c3b92..323c0ac8ed 100644
--- a/contrib/pg_buffercache/Makefile
+++ b/contrib/pg_buffercache/Makefile
@@ -3,8 +3,8 @@
MODULE_big = pg_buffercache
OBJS = pg_buffercache_pages.o
-DATA_built = pg_buffercache.sql
-DATA = uninstall_pg_buffercache.sql
+EXTENSION = pg_buffercache
+DATA = pg_buffercache--1.0.sql pg_buffercache--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/pg_buffercache/pg_buffercache.sql.in b/contrib/pg_buffercache/pg_buffercache--1.0.sql
index 88b5e643ac..a49d171e04 100644
--- a/contrib/pg_buffercache/pg_buffercache.sql.in
+++ b/contrib/pg_buffercache/pg_buffercache--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/pg_buffercache/pg_buffercache.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/pg_buffercache/pg_buffercache--1.0.sql */
-- Register the function.
CREATE OR REPLACE FUNCTION pg_buffercache_pages()
@@ -15,6 +12,6 @@ CREATE VIEW pg_buffercache AS
(bufferid integer, relfilenode oid, reltablespace oid, reldatabase oid,
relforknumber int2, relblocknumber int8, isdirty bool, usagecount int2);
--- Don't want these to be available at public.
+-- Don't want these to be available to public.
REVOKE ALL ON FUNCTION pg_buffercache_pages() FROM PUBLIC;
REVOKE ALL ON pg_buffercache FROM PUBLIC;
diff --git a/contrib/pg_buffercache/pg_buffercache--unpackaged--1.0.sql b/contrib/pg_buffercache/pg_buffercache--unpackaged--1.0.sql
new file mode 100644
index 0000000000..f00a954d86
--- /dev/null
+++ b/contrib/pg_buffercache/pg_buffercache--unpackaged--1.0.sql
@@ -0,0 +1,4 @@
+/* contrib/pg_buffercache/pg_buffercache--unpackaged--1.0.sql */
+
+ALTER EXTENSION pg_buffercache ADD function pg_buffercache_pages();
+ALTER EXTENSION pg_buffercache ADD view pg_buffercache;
diff --git a/contrib/pg_buffercache/pg_buffercache.control b/contrib/pg_buffercache/pg_buffercache.control
new file mode 100644
index 0000000000..709513c334
--- /dev/null
+++ b/contrib/pg_buffercache/pg_buffercache.control
@@ -0,0 +1,5 @@
+# pg_buffercache extension
+comment = 'examine the shared buffer cache'
+default_version = '1.0'
+module_pathname = '$libdir/pg_buffercache'
+relocatable = true
diff --git a/contrib/pg_buffercache/uninstall_pg_buffercache.sql b/contrib/pg_buffercache/uninstall_pg_buffercache.sql
deleted file mode 100644
index 62617cd20d..0000000000
--- a/contrib/pg_buffercache/uninstall_pg_buffercache.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-/* contrib/pg_buffercache/uninstall_pg_buffercache.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP VIEW pg_buffercache;
-
-DROP FUNCTION pg_buffercache_pages();
diff --git a/contrib/pg_freespacemap/.gitignore b/contrib/pg_freespacemap/.gitignore
deleted file mode 100644
index 645433a39f..0000000000
--- a/contrib/pg_freespacemap/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/pg_freespacemap.sql
diff --git a/contrib/pg_freespacemap/Makefile b/contrib/pg_freespacemap/Makefile
index 65539d5d71..b2e3ba3aa3 100644
--- a/contrib/pg_freespacemap/Makefile
+++ b/contrib/pg_freespacemap/Makefile
@@ -3,8 +3,8 @@
MODULE_big = pg_freespacemap
OBJS = pg_freespacemap.o
-DATA_built = pg_freespacemap.sql
-DATA = uninstall_pg_freespacemap.sql
+EXTENSION = pg_freespacemap
+DATA = pg_freespacemap--1.0.sql pg_freespacemap--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/pg_freespacemap/pg_freespacemap.sql.in b/contrib/pg_freespacemap/pg_freespacemap--1.0.sql
index 5ef8ba46ad..19f099ee37 100644
--- a/contrib/pg_freespacemap/pg_freespacemap.sql.in
+++ b/contrib/pg_freespacemap/pg_freespacemap--1.0.sql
@@ -1,8 +1,4 @@
-/* contrib/pg_freespacemap/pg_freespacemap.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
-
+/* contrib/pg_freespacemap/pg_freespacemap--1.0.sql */
-- Register the C function.
CREATE OR REPLACE FUNCTION pg_freespace(regclass, bigint)
diff --git a/contrib/pg_freespacemap/pg_freespacemap--unpackaged--1.0.sql b/contrib/pg_freespacemap/pg_freespacemap--unpackaged--1.0.sql
new file mode 100644
index 0000000000..4c7487fa4e
--- /dev/null
+++ b/contrib/pg_freespacemap/pg_freespacemap--unpackaged--1.0.sql
@@ -0,0 +1,4 @@
+/* contrib/pg_freespacemap/pg_freespacemap--unpackaged--1.0.sql */
+
+ALTER EXTENSION pg_freespacemap ADD function pg_freespace(regclass,bigint);
+ALTER EXTENSION pg_freespacemap ADD function pg_freespace(regclass);
diff --git a/contrib/pg_freespacemap/pg_freespacemap.control b/contrib/pg_freespacemap/pg_freespacemap.control
new file mode 100644
index 0000000000..34b695ff75
--- /dev/null
+++ b/contrib/pg_freespacemap/pg_freespacemap.control
@@ -0,0 +1,5 @@
+# pg_freespacemap extension
+comment = 'examine the free space map (FSM)'
+default_version = '1.0'
+module_pathname = '$libdir/pg_freespacemap'
+relocatable = true
diff --git a/contrib/pg_freespacemap/uninstall_pg_freespacemap.sql b/contrib/pg_freespacemap/uninstall_pg_freespacemap.sql
deleted file mode 100644
index 168506708a..0000000000
--- a/contrib/pg_freespacemap/uninstall_pg_freespacemap.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-/* contrib/pg_freespacemap/uninstall_pg_freespacemap.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION pg_freespace(regclass, bigint);
-DROP FUNCTION pg_freespace(regclass);
diff --git a/contrib/pg_stat_statements/.gitignore b/contrib/pg_stat_statements/.gitignore
deleted file mode 100644
index 2ca3f068d0..0000000000
--- a/contrib/pg_stat_statements/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/pg_stat_statements.sql
diff --git a/contrib/pg_stat_statements/Makefile b/contrib/pg_stat_statements/Makefile
index efb26a90f6..e086fd8a82 100644
--- a/contrib/pg_stat_statements/Makefile
+++ b/contrib/pg_stat_statements/Makefile
@@ -1,10 +1,11 @@
# contrib/pg_stat_statements/Makefile
MODULE_big = pg_stat_statements
-DATA_built = pg_stat_statements.sql
-DATA = uninstall_pg_stat_statements.sql
OBJS = pg_stat_statements.o
+EXTENSION = pg_stat_statements
+DATA = pg_stat_statements--1.0.sql pg_stat_statements--unpackaged--1.0.sql
+
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
diff --git a/contrib/pg_stat_statements/pg_stat_statements.sql.in b/contrib/pg_stat_statements/pg_stat_statements--1.0.sql
index 56d5fd591a..e17b82c616 100644
--- a/contrib/pg_stat_statements/pg_stat_statements.sql.in
+++ b/contrib/pg_stat_statements/pg_stat_statements--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/pg_stat_statements/pg_stat_statements.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/pg_stat_statements/pg_stat_statements--1.0.sql */
-- Register functions.
CREATE FUNCTION pg_stat_statements_reset()
diff --git a/contrib/pg_stat_statements/pg_stat_statements--unpackaged--1.0.sql b/contrib/pg_stat_statements/pg_stat_statements--unpackaged--1.0.sql
new file mode 100644
index 0000000000..9dda85cbdf
--- /dev/null
+++ b/contrib/pg_stat_statements/pg_stat_statements--unpackaged--1.0.sql
@@ -0,0 +1,5 @@
+/* contrib/pg_stat_statements/pg_stat_statements--unpackaged--1.0.sql */
+
+ALTER EXTENSION pg_stat_statements ADD function pg_stat_statements_reset();
+ALTER EXTENSION pg_stat_statements ADD function pg_stat_statements();
+ALTER EXTENSION pg_stat_statements ADD view pg_stat_statements;
diff --git a/contrib/pg_stat_statements/pg_stat_statements.control b/contrib/pg_stat_statements/pg_stat_statements.control
new file mode 100644
index 0000000000..6f9a947122
--- /dev/null
+++ b/contrib/pg_stat_statements/pg_stat_statements.control
@@ -0,0 +1,5 @@
+# pg_stat_statements extension
+comment = 'track execution statistics of all SQL statements executed'
+default_version = '1.0'
+module_pathname = '$libdir/pg_stat_statements'
+relocatable = true
diff --git a/contrib/pg_stat_statements/uninstall_pg_stat_statements.sql b/contrib/pg_stat_statements/uninstall_pg_stat_statements.sql
deleted file mode 100644
index d2832a2986..0000000000
--- a/contrib/pg_stat_statements/uninstall_pg_stat_statements.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-/* contrib/pg_stat_statements/uninstall_pg_stat_statements.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP VIEW pg_stat_statements;
-DROP FUNCTION pg_stat_statements();
-DROP FUNCTION pg_stat_statements_reset();
diff --git a/contrib/pg_test_fsync/Makefile b/contrib/pg_test_fsync/Makefile
index a9365667b3..b456429098 100644
--- a/contrib/pg_test_fsync/Makefile
+++ b/contrib/pg_test_fsync/Makefile
@@ -1,6 +1,3 @@
-#
-# Makefile for pg_test_fsync
-#
# contrib/pg_test_fsync/Makefile
PGFILEDESC = "pg_test_fsync - test various disk sync methods"
diff --git a/contrib/pg_trgm/.gitignore b/contrib/pg_trgm/.gitignore
index 9cda826ca4..19b6c5ba42 100644
--- a/contrib/pg_trgm/.gitignore
+++ b/contrib/pg_trgm/.gitignore
@@ -1,3 +1,2 @@
-/pg_trgm.sql
# Generated subdirectories
/results/
diff --git a/contrib/pg_trgm/Makefile b/contrib/pg_trgm/Makefile
index cf2dec795c..64fd69f2cb 100644
--- a/contrib/pg_trgm/Makefile
+++ b/contrib/pg_trgm/Makefile
@@ -3,8 +3,9 @@
MODULE_big = pg_trgm
OBJS = trgm_op.o trgm_gist.o trgm_gin.o
-DATA_built = pg_trgm.sql
-DATA = uninstall_pg_trgm.sql
+EXTENSION = pg_trgm
+DATA = pg_trgm--1.0.sql pg_trgm--unpackaged--1.0.sql
+
REGRESS = pg_trgm
ifdef USE_PGXS
diff --git a/contrib/pg_trgm/expected/pg_trgm.out b/contrib/pg_trgm/expected/pg_trgm.out
index 6e73af2a32..e7af7d4890 100644
--- a/contrib/pg_trgm/expected/pg_trgm.out
+++ b/contrib/pg_trgm/expected/pg_trgm.out
@@ -1,10 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of pg_tgrm.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION pg_trgm;
select show_trgm('');
show_trgm
-----------
diff --git a/contrib/pg_trgm/pg_trgm.sql.in b/contrib/pg_trgm/pg_trgm--1.0.sql
index 12a8c21071..fc31728dcc 100644
--- a/contrib/pg_trgm/pg_trgm.sql.in
+++ b/contrib/pg_trgm/pg_trgm--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/pg_trgm/pg_trgm.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/pg_trgm/pg_trgm--1.0.sql */
CREATE OR REPLACE FUNCTION set_limit(float4)
RETURNS float4
diff --git a/contrib/pg_trgm/pg_trgm--unpackaged--1.0.sql b/contrib/pg_trgm/pg_trgm--unpackaged--1.0.sql
new file mode 100644
index 0000000000..ffcb8c1e09
--- /dev/null
+++ b/contrib/pg_trgm/pg_trgm--unpackaged--1.0.sql
@@ -0,0 +1,28 @@
+/* contrib/pg_trgm/pg_trgm--unpackaged--1.0.sql */
+
+ALTER EXTENSION pg_trgm ADD function set_limit(real);
+ALTER EXTENSION pg_trgm ADD function show_limit();
+ALTER EXTENSION pg_trgm ADD function show_trgm(text);
+ALTER EXTENSION pg_trgm ADD function similarity(text,text);
+ALTER EXTENSION pg_trgm ADD function similarity_op(text,text);
+ALTER EXTENSION pg_trgm ADD operator %(text,text);
+ALTER EXTENSION pg_trgm ADD function similarity_dist(text,text);
+ALTER EXTENSION pg_trgm ADD operator <->(text,text);
+ALTER EXTENSION pg_trgm ADD type gtrgm;
+ALTER EXTENSION pg_trgm ADD function gtrgm_in(cstring);
+ALTER EXTENSION pg_trgm ADD function gtrgm_out(gtrgm);
+ALTER EXTENSION pg_trgm ADD function gtrgm_consistent(internal,text,integer,oid,internal);
+ALTER EXTENSION pg_trgm ADD function gtrgm_distance(internal,text,integer,oid);
+ALTER EXTENSION pg_trgm ADD function gtrgm_compress(internal);
+ALTER EXTENSION pg_trgm ADD function gtrgm_decompress(internal);
+ALTER EXTENSION pg_trgm ADD function gtrgm_penalty(internal,internal,internal);
+ALTER EXTENSION pg_trgm ADD function gtrgm_picksplit(internal,internal);
+ALTER EXTENSION pg_trgm ADD function gtrgm_union(bytea,internal);
+ALTER EXTENSION pg_trgm ADD function gtrgm_same(gtrgm,gtrgm,internal);
+ALTER EXTENSION pg_trgm ADD operator family gist_trgm_ops using gist;
+ALTER EXTENSION pg_trgm ADD operator class gist_trgm_ops using gist;
+ALTER EXTENSION pg_trgm ADD function gin_extract_value_trgm(text,internal);
+ALTER EXTENSION pg_trgm ADD function gin_extract_query_trgm(text,internal,smallint,internal,internal,internal,internal);
+ALTER EXTENSION pg_trgm ADD function gin_trgm_consistent(internal,smallint,text,integer,internal,internal,internal,internal);
+ALTER EXTENSION pg_trgm ADD operator family gin_trgm_ops using gin;
+ALTER EXTENSION pg_trgm ADD operator class gin_trgm_ops using gin;
diff --git a/contrib/pg_trgm/pg_trgm.control b/contrib/pg_trgm/pg_trgm.control
new file mode 100644
index 0000000000..70404d881d
--- /dev/null
+++ b/contrib/pg_trgm/pg_trgm.control
@@ -0,0 +1,5 @@
+# pg_trgm extension
+comment = 'text similarity measurement and index searching based on trigrams'
+default_version = '1.0'
+module_pathname = '$libdir/pg_trgm'
+relocatable = true
diff --git a/contrib/pg_trgm/sql/pg_trgm.sql b/contrib/pg_trgm/sql/pg_trgm.sql
index b8209344c3..ea902f602f 100644
--- a/contrib/pg_trgm/sql/pg_trgm.sql
+++ b/contrib/pg_trgm/sql/pg_trgm.sql
@@ -1,12 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of pg_tgrm.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i pg_trgm.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION pg_trgm;
select show_trgm('');
select show_trgm('(*&^$@%@');
diff --git a/contrib/pg_trgm/uninstall_pg_trgm.sql b/contrib/pg_trgm/uninstall_pg_trgm.sql
deleted file mode 100644
index 961e40ca48..0000000000
--- a/contrib/pg_trgm/uninstall_pg_trgm.sql
+++ /dev/null
@@ -1,48 +0,0 @@
-/* contrib/pg_trgm/uninstall_pg_trgm.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP OPERATOR CLASS gist_trgm_ops USING gist;
-
-DROP FUNCTION gtrgm_same(gtrgm, gtrgm, internal);
-
-DROP FUNCTION gtrgm_union(bytea, internal);
-
-DROP FUNCTION gtrgm_picksplit(internal, internal);
-
-DROP FUNCTION gtrgm_penalty(internal,internal,internal);
-
-DROP FUNCTION gtrgm_decompress(internal);
-
-DROP FUNCTION gtrgm_compress(internal);
-
-DROP FUNCTION gtrgm_consistent(internal,text,int,oid,internal);
-
-DROP FUNCTION gtrgm_distance(internal,text,int,oid);
-
-DROP TYPE gtrgm CASCADE;
-
-DROP OPERATOR CLASS gin_trgm_ops USING gin;
-
-DROP FUNCTION gin_extract_value_trgm(text, internal);
-
-DROP FUNCTION gin_extract_query_trgm(text, internal, int2, internal, internal, internal, internal);
-
-DROP FUNCTION gin_trgm_consistent(internal, int2, text, int4, internal, internal, internal, internal);
-
-DROP OPERATOR % (text, text);
-
-DROP FUNCTION similarity_op(text,text);
-
-DROP OPERATOR <-> (text, text);
-
-DROP FUNCTION similarity_dist(text,text);
-
-DROP FUNCTION similarity(text,text);
-
-DROP FUNCTION show_trgm(text);
-
-DROP FUNCTION show_limit();
-
-DROP FUNCTION set_limit(float4);
diff --git a/contrib/pg_upgrade/Makefile b/contrib/pg_upgrade/Makefile
index 79ac234b5e..8f3fd7c9bb 100644
--- a/contrib/pg_upgrade/Makefile
+++ b/contrib/pg_upgrade/Makefile
@@ -1,6 +1,3 @@
-#
-# Makefile for pg_upgrade
-#
# contrib/pg_upgrade/Makefile
PGFILEDESC = "pg_upgrade - an in-place binary upgrade utility"
diff --git a/contrib/pg_upgrade_support/Makefile b/contrib/pg_upgrade_support/Makefile
index e23c9bebcb..f7def160c3 100644
--- a/contrib/pg_upgrade_support/Makefile
+++ b/contrib/pg_upgrade_support/Makefile
@@ -1,6 +1,3 @@
-#
-# Makefile for pg_upgrade_support
-#
# contrib/pg_upgrade_support/Makefile
PGFILEDESC = "pg_upgrade_support - server-side functions for pg_upgrade"
diff --git a/contrib/pgcrypto/.gitignore b/contrib/pgcrypto/.gitignore
index 07b24d98f0..19b6c5ba42 100644
--- a/contrib/pgcrypto/.gitignore
+++ b/contrib/pgcrypto/.gitignore
@@ -1,3 +1,2 @@
-/pgcrypto.sql
# Generated subdirectories
/results/
diff --git a/contrib/pgcrypto/Makefile b/contrib/pgcrypto/Makefile
index f429fab4ed..dadec953c2 100644
--- a/contrib/pgcrypto/Makefile
+++ b/contrib/pgcrypto/Makefile
@@ -1,6 +1,4 @@
-#
# contrib/pgcrypto/Makefile
-#
INT_SRCS = md5.c sha1.c sha2.c internal.c internal-sha2.c blf.c rijndael.c \
fortuna.c random.c pgp-mpi-internal.c imath.c
@@ -26,9 +24,9 @@ SRCS = pgcrypto.c px.c px-hmac.c px-crypt.c \
MODULE_big = pgcrypto
OBJS = $(SRCS:.c=.o)
-DATA_built = pgcrypto.sql
-DATA = uninstall_pgcrypto.sql
-EXTRA_CLEAN = gen-rtab
+
+EXTENSION = pgcrypto
+DATA = pgcrypto--1.0.sql pgcrypto--unpackaged--1.0.sql
REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
$(CF_TESTS) \
@@ -36,6 +34,7 @@ REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
pgp-armor pgp-decrypt pgp-encrypt $(CF_PGP_TESTS) \
pgp-pubkey-decrypt pgp-pubkey-encrypt pgp-info
+EXTRA_CLEAN = gen-rtab
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/pgcrypto/expected/init.out b/contrib/pgcrypto/expected/init.out
index 4cb1081997..bd8f8e1380 100644
--- a/contrib/pgcrypto/expected/init.out
+++ b/contrib/pgcrypto/expected/init.out
@@ -1,13 +1,7 @@
--
-- init pgcrypto
--
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of pgcrypto.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION pgcrypto;
-- ensure consistent test output regardless of the default bytea format
SET bytea_output TO escape;
-- check for encoding fn's
diff --git a/contrib/pgcrypto/pgcrypto.sql.in b/contrib/pgcrypto/pgcrypto--1.0.sql
index 37ae100412..29b489fbe5 100644
--- a/contrib/pgcrypto/pgcrypto.sql.in
+++ b/contrib/pgcrypto/pgcrypto--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/pgcrypto/pgcrypto.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/pgcrypto/pgcrypto--1.0.sql */
CREATE OR REPLACE FUNCTION digest(text, text)
RETURNS bytea
diff --git a/contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql b/contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql
new file mode 100644
index 0000000000..64f0cdf23a
--- /dev/null
+++ b/contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql
@@ -0,0 +1,35 @@
+/* contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql */
+
+ALTER EXTENSION pgcrypto ADD function digest(text,text);
+ALTER EXTENSION pgcrypto ADD function digest(bytea,text);
+ALTER EXTENSION pgcrypto ADD function hmac(text,text,text);
+ALTER EXTENSION pgcrypto ADD function hmac(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function crypt(text,text);
+ALTER EXTENSION pgcrypto ADD function gen_salt(text);
+ALTER EXTENSION pgcrypto ADD function gen_salt(text,integer);
+ALTER EXTENSION pgcrypto ADD function encrypt(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function decrypt(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function encrypt_iv(bytea,bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function decrypt_iv(bytea,bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function gen_random_bytes(integer);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_encrypt(text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_encrypt_bytea(bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_encrypt(text,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_encrypt_bytea(bytea,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_decrypt(bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_decrypt_bytea(bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_decrypt(bytea,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_decrypt_bytea(bytea,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_encrypt(text,bytea);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_encrypt_bytea(bytea,bytea);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_encrypt(text,bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_encrypt_bytea(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt(bytea,bytea);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt_bytea(bytea,bytea);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt_bytea(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt(bytea,bytea,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt_bytea(bytea,bytea,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_key_id(bytea);
+ALTER EXTENSION pgcrypto ADD function armor(bytea);
+ALTER EXTENSION pgcrypto ADD function dearmor(text);
diff --git a/contrib/pgcrypto/pgcrypto.control b/contrib/pgcrypto/pgcrypto.control
new file mode 100644
index 0000000000..8375cf9e7b
--- /dev/null
+++ b/contrib/pgcrypto/pgcrypto.control
@@ -0,0 +1,5 @@
+# pgcrypto extension
+comment = 'cryptographic functions'
+default_version = '1.0'
+module_pathname = '$libdir/pgcrypto'
+relocatable = true
diff --git a/contrib/pgcrypto/sql/init.sql b/contrib/pgcrypto/sql/init.sql
index 8c1d2192a6..5c3d100576 100644
--- a/contrib/pgcrypto/sql/init.sql
+++ b/contrib/pgcrypto/sql/init.sql
@@ -2,15 +2,7 @@
-- init pgcrypto
--
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of pgcrypto.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i pgcrypto.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION pgcrypto;
-- ensure consistent test output regardless of the default bytea format
SET bytea_output TO escape;
diff --git a/contrib/pgcrypto/uninstall_pgcrypto.sql b/contrib/pgcrypto/uninstall_pgcrypto.sql
deleted file mode 100644
index 3005c50333..0000000000
--- a/contrib/pgcrypto/uninstall_pgcrypto.sql
+++ /dev/null
@@ -1,45 +0,0 @@
-/* contrib/pgcrypto/uninstall_pgcrypto.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION digest(text, text);
-DROP FUNCTION digest(bytea, text);
-
-DROP FUNCTION hmac(text, text, text);
-DROP FUNCTION hmac(bytea, bytea, text);
-
-DROP FUNCTION crypt(text, text);
-DROP FUNCTION gen_salt(text);
-DROP FUNCTION gen_salt(text, int4);
-
-DROP FUNCTION encrypt(bytea, bytea, text);
-DROP FUNCTION decrypt(bytea, bytea, text);
-DROP FUNCTION encrypt_iv(bytea, bytea, bytea, text);
-DROP FUNCTION decrypt_iv(bytea, bytea, bytea, text);
-
-DROP FUNCTION gen_random_bytes(int4);
-
-DROP FUNCTION pgp_sym_encrypt(text, text);
-DROP FUNCTION pgp_sym_encrypt_bytea(bytea, text);
-DROP FUNCTION pgp_sym_encrypt(text, text, text);
-DROP FUNCTION pgp_sym_encrypt_bytea(bytea, text, text);
-DROP FUNCTION pgp_sym_decrypt(bytea, text);
-DROP FUNCTION pgp_sym_decrypt_bytea(bytea, text);
-DROP FUNCTION pgp_sym_decrypt(bytea, text, text);
-DROP FUNCTION pgp_sym_decrypt_bytea(bytea, text, text);
-
-DROP FUNCTION pgp_pub_encrypt(text, bytea);
-DROP FUNCTION pgp_pub_encrypt_bytea(bytea, bytea);
-DROP FUNCTION pgp_pub_encrypt(text, bytea, text);
-DROP FUNCTION pgp_pub_encrypt_bytea(bytea, bytea, text);
-DROP FUNCTION pgp_pub_decrypt(bytea, bytea);
-DROP FUNCTION pgp_pub_decrypt_bytea(bytea, bytea);
-DROP FUNCTION pgp_pub_decrypt(bytea, bytea, text);
-DROP FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text);
-DROP FUNCTION pgp_pub_decrypt(bytea, bytea, text, text);
-DROP FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text, text);
-
-DROP FUNCTION pgp_key_id(bytea);
-DROP FUNCTION armor(bytea);
-DROP FUNCTION dearmor(text);
diff --git a/contrib/pgrowlocks/.gitignore b/contrib/pgrowlocks/.gitignore
deleted file mode 100644
index b2729282bf..0000000000
--- a/contrib/pgrowlocks/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/pgrowlocks.sql
diff --git a/contrib/pgrowlocks/Makefile b/contrib/pgrowlocks/Makefile
index fd338d75d7..f56389b0e2 100644
--- a/contrib/pgrowlocks/Makefile
+++ b/contrib/pgrowlocks/Makefile
@@ -1,15 +1,10 @@
-#-------------------------------------------------------------------------
-#
-# pgrowlocks Makefile
-#
# contrib/pgrowlocks/Makefile
-#
-#-------------------------------------------------------------------------
MODULE_big = pgrowlocks
OBJS = pgrowlocks.o
-DATA_built = pgrowlocks.sql
-DATA = uninstall_pgrowlocks.sql
+
+EXTENSION = pgrowlocks
+DATA = pgrowlocks--1.0.sql pgrowlocks--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/pgrowlocks/pgrowlocks.sql.in b/contrib/pgrowlocks/pgrowlocks--1.0.sql
index 3bcb3ee7ea..8b5fc9a1c8 100644
--- a/contrib/pgrowlocks/pgrowlocks.sql.in
+++ b/contrib/pgrowlocks/pgrowlocks--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/pgrowlocks/pgrowlocks.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/pgrowlocks/pgrowlocks--1.0.sql */
CREATE OR REPLACE FUNCTION pgrowlocks(IN relname text,
OUT locked_row TID, -- row TID
diff --git a/contrib/pgrowlocks/pgrowlocks--unpackaged--1.0.sql b/contrib/pgrowlocks/pgrowlocks--unpackaged--1.0.sql
new file mode 100644
index 0000000000..2d9d1eed41
--- /dev/null
+++ b/contrib/pgrowlocks/pgrowlocks--unpackaged--1.0.sql
@@ -0,0 +1,3 @@
+/* contrib/pgrowlocks/pgrowlocks--unpackaged--1.0.sql */
+
+ALTER EXTENSION pgrowlocks ADD function pgrowlocks(text);
diff --git a/contrib/pgrowlocks/pgrowlocks.control b/contrib/pgrowlocks/pgrowlocks.control
new file mode 100644
index 0000000000..a6ba164515
--- /dev/null
+++ b/contrib/pgrowlocks/pgrowlocks.control
@@ -0,0 +1,5 @@
+# pgrowlocks extension
+comment = 'show row-level locking information'
+default_version = '1.0'
+module_pathname = '$libdir/pgrowlocks'
+relocatable = true
diff --git a/contrib/pgrowlocks/uninstall_pgrowlocks.sql b/contrib/pgrowlocks/uninstall_pgrowlocks.sql
deleted file mode 100644
index 004e97c0e9..0000000000
--- a/contrib/pgrowlocks/uninstall_pgrowlocks.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-/* contrib/pgrowlocks/uninstall_pgrowlocks.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION pgrowlocks(text);
diff --git a/contrib/pgstattuple/.gitignore b/contrib/pgstattuple/.gitignore
deleted file mode 100644
index 69b22b64cd..0000000000
--- a/contrib/pgstattuple/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/pgstattuple.sql
diff --git a/contrib/pgstattuple/Makefile b/contrib/pgstattuple/Makefile
index 33386cdf17..13b87090ee 100644
--- a/contrib/pgstattuple/Makefile
+++ b/contrib/pgstattuple/Makefile
@@ -1,15 +1,10 @@
-#-------------------------------------------------------------------------
-#
-# pgstattuple Makefile
-#
# contrib/pgstattuple/Makefile
-#
-#-------------------------------------------------------------------------
MODULE_big = pgstattuple
OBJS = pgstattuple.o pgstatindex.o
-DATA_built = pgstattuple.sql
-DATA = uninstall_pgstattuple.sql
+
+EXTENSION = pgstattuple
+DATA = pgstattuple--1.0.sql pgstattuple--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/pgstattuple/pgstattuple.sql.in b/contrib/pgstattuple/pgstattuple--1.0.sql
index 6a09136596..84b91dda0a 100644
--- a/contrib/pgstattuple/pgstattuple.sql.in
+++ b/contrib/pgstattuple/pgstattuple--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/pgstattuple/pgstattuple.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/pgstattuple/pgstattuple--1.0.sql */
CREATE OR REPLACE FUNCTION pgstattuple(IN relname text,
OUT table_len BIGINT, -- physical table length in bytes
diff --git a/contrib/pgstattuple/pgstattuple--unpackaged--1.0.sql b/contrib/pgstattuple/pgstattuple--unpackaged--1.0.sql
new file mode 100644
index 0000000000..3cfb8db534
--- /dev/null
+++ b/contrib/pgstattuple/pgstattuple--unpackaged--1.0.sql
@@ -0,0 +1,6 @@
+/* contrib/pgstattuple/pgstattuple--unpackaged--1.0.sql */
+
+ALTER EXTENSION pgstattuple ADD function pgstattuple(text);
+ALTER EXTENSION pgstattuple ADD function pgstattuple(oid);
+ALTER EXTENSION pgstattuple ADD function pgstatindex(text);
+ALTER EXTENSION pgstattuple ADD function pg_relpages(text);
diff --git a/contrib/pgstattuple/pgstattuple.control b/contrib/pgstattuple/pgstattuple.control
new file mode 100644
index 0000000000..7b5129b2f2
--- /dev/null
+++ b/contrib/pgstattuple/pgstattuple.control
@@ -0,0 +1,5 @@
+# pgstattuple extension
+comment = 'show tuple-level statistics'
+default_version = '1.0'
+module_pathname = '$libdir/pgstattuple'
+relocatable = true
diff --git a/contrib/pgstattuple/uninstall_pgstattuple.sql b/contrib/pgstattuple/uninstall_pgstattuple.sql
deleted file mode 100644
index 29eac40f29..0000000000
--- a/contrib/pgstattuple/uninstall_pgstattuple.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-/* contrib/pgstattuple/uninstall_pgstattuple.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION pgstattuple(text);
-DROP FUNCTION pgstattuple(oid);
-DROP FUNCTION pgstatindex(text);
-DROP FUNCTION pg_relpages(text);
diff --git a/contrib/seg/.gitignore b/contrib/seg/.gitignore
index a8973ff696..102f8b3246 100644
--- a/contrib/seg/.gitignore
+++ b/contrib/seg/.gitignore
@@ -1,5 +1,4 @@
/segparse.c
/segscan.c
-/seg.sql
# Generated subdirectories
/results/
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index e8c7a44845..d84934c67f 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -2,8 +2,10 @@
MODULE_big = seg
OBJS = seg.o segparse.o
-DATA_built = seg.sql
-DATA = uninstall_seg.sql
+
+EXTENSION = seg
+DATA = seg--1.0.sql seg--unpackaged--1.0.sql
+
REGRESS = seg
EXTRA_CLEAN = y.tab.c y.tab.h
diff --git a/contrib/seg/expected/seg.out b/contrib/seg/expected/seg.out
index 17c803e50e..1f82a4abb8 100644
--- a/contrib/seg/expected/seg.out
+++ b/contrib/seg/expected/seg.out
@@ -1,13 +1,7 @@
--
-- Test seg datatype
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of seg.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION seg;
--
-- testing the input and output functions
--
diff --git a/contrib/seg/expected/seg_1.out b/contrib/seg/expected/seg_1.out
index a4cca8b391..563c744b2d 100644
--- a/contrib/seg/expected/seg_1.out
+++ b/contrib/seg/expected/seg_1.out
@@ -1,13 +1,7 @@
--
-- Test seg datatype
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of seg.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION seg;
--
-- testing the input and output functions
--
diff --git a/contrib/seg/seg.sql.in b/contrib/seg/seg--1.0.sql
index 9bd747656c..02d8ffadb0 100644
--- a/contrib/seg/seg.sql.in
+++ b/contrib/seg/seg--1.0.sql
@@ -1,10 +1,6 @@
-/* contrib/seg/seg.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/seg/seg--1.0.sql */
-- Create the user-defined type for 1-D floating point intervals (seg)
---
CREATE OR REPLACE FUNCTION seg_in(cstring)
RETURNS seg
diff --git a/contrib/seg/seg--unpackaged--1.0.sql b/contrib/seg/seg--unpackaged--1.0.sql
new file mode 100644
index 0000000000..9fefbfc9aa
--- /dev/null
+++ b/contrib/seg/seg--unpackaged--1.0.sql
@@ -0,0 +1,51 @@
+/* contrib/seg/seg--unpackaged--1.0.sql */
+
+ALTER EXTENSION seg ADD type seg;
+ALTER EXTENSION seg ADD function seg_in(cstring);
+ALTER EXTENSION seg ADD function seg_out(seg);
+ALTER EXTENSION seg ADD function seg_over_left(seg,seg);
+ALTER EXTENSION seg ADD function seg_over_right(seg,seg);
+ALTER EXTENSION seg ADD function seg_left(seg,seg);
+ALTER EXTENSION seg ADD function seg_right(seg,seg);
+ALTER EXTENSION seg ADD function seg_lt(seg,seg);
+ALTER EXTENSION seg ADD function seg_le(seg,seg);
+ALTER EXTENSION seg ADD function seg_gt(seg,seg);
+ALTER EXTENSION seg ADD function seg_ge(seg,seg);
+ALTER EXTENSION seg ADD function seg_contains(seg,seg);
+ALTER EXTENSION seg ADD function seg_contained(seg,seg);
+ALTER EXTENSION seg ADD function seg_overlap(seg,seg);
+ALTER EXTENSION seg ADD function seg_same(seg,seg);
+ALTER EXTENSION seg ADD function seg_different(seg,seg);
+ALTER EXTENSION seg ADD function seg_cmp(seg,seg);
+ALTER EXTENSION seg ADD function seg_union(seg,seg);
+ALTER EXTENSION seg ADD function seg_inter(seg,seg);
+ALTER EXTENSION seg ADD function seg_size(seg);
+ALTER EXTENSION seg ADD function seg_center(seg);
+ALTER EXTENSION seg ADD function seg_upper(seg);
+ALTER EXTENSION seg ADD function seg_lower(seg);
+ALTER EXTENSION seg ADD operator >(seg,seg);
+ALTER EXTENSION seg ADD operator >=(seg,seg);
+ALTER EXTENSION seg ADD operator <(seg,seg);
+ALTER EXTENSION seg ADD operator <=(seg,seg);
+ALTER EXTENSION seg ADD operator >>(seg,seg);
+ALTER EXTENSION seg ADD operator <<(seg,seg);
+ALTER EXTENSION seg ADD operator &<(seg,seg);
+ALTER EXTENSION seg ADD operator &&(seg,seg);
+ALTER EXTENSION seg ADD operator &>(seg,seg);
+ALTER EXTENSION seg ADD operator <>(seg,seg);
+ALTER EXTENSION seg ADD operator =(seg,seg);
+ALTER EXTENSION seg ADD operator <@(seg,seg);
+ALTER EXTENSION seg ADD operator @>(seg,seg);
+ALTER EXTENSION seg ADD operator ~(seg,seg);
+ALTER EXTENSION seg ADD operator @(seg,seg);
+ALTER EXTENSION seg ADD function gseg_consistent(internal,seg,integer,oid,internal);
+ALTER EXTENSION seg ADD function gseg_compress(internal);
+ALTER EXTENSION seg ADD function gseg_decompress(internal);
+ALTER EXTENSION seg ADD function gseg_penalty(internal,internal,internal);
+ALTER EXTENSION seg ADD function gseg_picksplit(internal,internal);
+ALTER EXTENSION seg ADD function gseg_union(internal,internal);
+ALTER EXTENSION seg ADD function gseg_same(seg,seg,internal);
+ALTER EXTENSION seg ADD operator family seg_ops using btree;
+ALTER EXTENSION seg ADD operator class seg_ops using btree;
+ALTER EXTENSION seg ADD operator family gist_seg_ops using gist;
+ALTER EXTENSION seg ADD operator class gist_seg_ops using gist;
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
new file mode 100644
index 0000000000..a1286962ee
--- /dev/null
+++ b/contrib/seg/seg.control
@@ -0,0 +1,5 @@
+# seg extension
+comment = 'data type for representing line segments or floating-point intervals'
+default_version = '1.0'
+module_pathname = '$libdir/seg'
+relocatable = true
diff --git a/contrib/seg/sql/seg.sql b/contrib/seg/sql/seg.sql
index b8a29d659a..7b7f138dbf 100644
--- a/contrib/seg/sql/seg.sql
+++ b/contrib/seg/sql/seg.sql
@@ -2,15 +2,7 @@
-- Test seg datatype
--
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of seg.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i seg.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION seg;
--
-- testing the input and output functions
diff --git a/contrib/seg/uninstall_seg.sql b/contrib/seg/uninstall_seg.sql
deleted file mode 100644
index 27e8ba901a..0000000000
--- a/contrib/seg/uninstall_seg.sql
+++ /dev/null
@@ -1,94 +0,0 @@
-/* contrib/seg/uninstall_seg.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP OPERATOR CLASS gist_seg_ops USING gist;
-
-DROP OPERATOR CLASS seg_ops USING btree;
-
-DROP FUNCTION gseg_same(seg, seg, internal);
-
-DROP FUNCTION gseg_union(internal, internal);
-
-DROP FUNCTION gseg_picksplit(internal, internal);
-
-DROP FUNCTION gseg_penalty(internal,internal,internal);
-
-DROP FUNCTION gseg_decompress(internal);
-
-DROP FUNCTION gseg_compress(internal);
-
-DROP FUNCTION gseg_consistent(internal,seg,int,oid,internal);
-
-DROP OPERATOR <@ (seg, seg);
-
-DROP OPERATOR @> (seg, seg);
-
-DROP OPERATOR ~ (seg, seg);
-
-DROP OPERATOR @ (seg, seg);
-
-DROP OPERATOR <> (seg, seg);
-
-DROP OPERATOR = (seg, seg);
-
-DROP OPERATOR >> (seg, seg);
-
-DROP OPERATOR &> (seg, seg);
-
-DROP OPERATOR && (seg, seg);
-
-DROP OPERATOR &< (seg, seg);
-
-DROP OPERATOR << (seg, seg);
-
-DROP OPERATOR >= (seg, seg);
-
-DROP OPERATOR > (seg, seg);
-
-DROP OPERATOR <= (seg, seg);
-
-DROP OPERATOR < (seg, seg);
-
-DROP FUNCTION seg_center(seg);
-
-DROP FUNCTION seg_lower(seg);
-
-DROP FUNCTION seg_upper(seg);
-
-DROP FUNCTION seg_size(seg);
-
-DROP FUNCTION seg_inter(seg, seg);
-
-DROP FUNCTION seg_union(seg, seg);
-
-DROP FUNCTION seg_cmp(seg, seg);
-
-DROP FUNCTION seg_different(seg, seg);
-
-DROP FUNCTION seg_same(seg, seg);
-
-DROP FUNCTION seg_overlap(seg, seg);
-
-DROP FUNCTION seg_contained(seg, seg);
-
-DROP FUNCTION seg_contains(seg, seg);
-
-DROP FUNCTION seg_ge(seg, seg);
-
-DROP FUNCTION seg_gt(seg, seg);
-
-DROP FUNCTION seg_le(seg, seg);
-
-DROP FUNCTION seg_lt(seg, seg);
-
-DROP FUNCTION seg_right(seg, seg);
-
-DROP FUNCTION seg_left(seg, seg);
-
-DROP FUNCTION seg_over_right(seg, seg);
-
-DROP FUNCTION seg_over_left(seg, seg);
-
-DROP TYPE seg CASCADE;
diff --git a/contrib/spi/.gitignore b/contrib/spi/.gitignore
deleted file mode 100644
index 6c07a33b11..0000000000
--- a/contrib/spi/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/autoinc.sql
-/insert_username.sql
-/moddatetime.sql
-/refint.sql
-/timetravel.sql
diff --git a/contrib/spi/Makefile b/contrib/spi/Makefile
index 531d406605..0c11bfcbbd 100644
--- a/contrib/spi/Makefile
+++ b/contrib/spi/Makefile
@@ -1,7 +1,15 @@
# contrib/spi/Makefile
MODULES = autoinc insert_username moddatetime refint timetravel
-DATA_built = $(addsuffix .sql, $(MODULES))
+
+EXTENSION = autoinc insert_username moddatetime refint timetravel
+
+DATA = autoinc--1.0.sql autoinc--unpackaged--1.0.sql \
+ insert_username--1.0.sql insert_username--unpackaged--1.0.sql \
+ moddatetime--1.0.sql moddatetime--unpackaged--1.0.sql \
+ refint--1.0.sql refint--unpackaged--1.0.sql \
+ timetravel--1.0.sql timetravel--unpackaged--1.0.sql
+
DOCS = $(addsuffix .example, $(MODULES))
# this is needed for the regression tests;
diff --git a/contrib/spi/autoinc--1.0.sql b/contrib/spi/autoinc--1.0.sql
new file mode 100644
index 0000000000..bf5ecab08b
--- /dev/null
+++ b/contrib/spi/autoinc--1.0.sql
@@ -0,0 +1,6 @@
+/* contrib/spi/autoinc--1.0.sql */
+
+CREATE OR REPLACE FUNCTION autoinc()
+RETURNS trigger
+AS 'MODULE_PATHNAME'
+LANGUAGE C;
diff --git a/contrib/spi/autoinc--unpackaged--1.0.sql b/contrib/spi/autoinc--unpackaged--1.0.sql
new file mode 100644
index 0000000000..232e9170fc
--- /dev/null
+++ b/contrib/spi/autoinc--unpackaged--1.0.sql
@@ -0,0 +1,3 @@
+/* contrib/spi/autoinc--unpackaged--1.0.sql */
+
+ALTER EXTENSION autoinc ADD function autoinc();
diff --git a/contrib/spi/autoinc.control b/contrib/spi/autoinc.control
new file mode 100644
index 0000000000..1d7a8e53d4
--- /dev/null
+++ b/contrib/spi/autoinc.control
@@ -0,0 +1,5 @@
+# autoinc extension
+comment = 'functions for autoincrementing fields'
+default_version = '1.0'
+module_pathname = '$libdir/autoinc'
+relocatable = true
diff --git a/contrib/spi/autoinc.sql.in b/contrib/spi/autoinc.sql.in
deleted file mode 100644
index 1fa322f9c7..0000000000
--- a/contrib/spi/autoinc.sql.in
+++ /dev/null
@@ -1,9 +0,0 @@
-/* contrib/spi/autoinc.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
-
-CREATE OR REPLACE FUNCTION autoinc()
-RETURNS trigger
-AS 'MODULE_PATHNAME'
-LANGUAGE C;
diff --git a/contrib/spi/insert_username--1.0.sql b/contrib/spi/insert_username--1.0.sql
new file mode 100644
index 0000000000..3867c57a2c
--- /dev/null
+++ b/contrib/spi/insert_username--1.0.sql
@@ -0,0 +1,6 @@
+/* contrib/spi/insert_username--1.0.sql */
+
+CREATE OR REPLACE FUNCTION insert_username()
+RETURNS trigger
+AS 'MODULE_PATHNAME'
+LANGUAGE C;
diff --git a/contrib/spi/insert_username--unpackaged--1.0.sql b/contrib/spi/insert_username--unpackaged--1.0.sql
new file mode 100644
index 0000000000..f53cb690f1
--- /dev/null
+++ b/contrib/spi/insert_username--unpackaged--1.0.sql
@@ -0,0 +1,3 @@
+/* contrib/spi/insert_username--unpackaged--1.0.sql */
+
+ALTER EXTENSION insert_username ADD function insert_username();
diff --git a/contrib/spi/insert_username.control b/contrib/spi/insert_username.control
new file mode 100644
index 0000000000..9d110643ee
--- /dev/null
+++ b/contrib/spi/insert_username.control
@@ -0,0 +1,5 @@
+# insert_username extension
+comment = 'functions for tracking who changed a table'
+default_version = '1.0'
+module_pathname = '$libdir/insert_username'
+relocatable = true
diff --git a/contrib/spi/insert_username.sql.in b/contrib/spi/insert_username.sql.in
deleted file mode 100644
index bdc2deb340..0000000000
--- a/contrib/spi/insert_username.sql.in
+++ /dev/null
@@ -1,9 +0,0 @@
-/* contrib/spi/insert_username.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
-
-CREATE OR REPLACE FUNCTION insert_username()
-RETURNS trigger
-AS 'MODULE_PATHNAME'
-LANGUAGE C;
diff --git a/contrib/spi/moddatetime--1.0.sql b/contrib/spi/moddatetime--1.0.sql
new file mode 100644
index 0000000000..00971c9fe1
--- /dev/null
+++ b/contrib/spi/moddatetime--1.0.sql
@@ -0,0 +1,6 @@
+/* contrib/spi/moddatetime--1.0.sql */
+
+CREATE OR REPLACE FUNCTION moddatetime()
+RETURNS trigger
+AS 'MODULE_PATHNAME'
+LANGUAGE C;
diff --git a/contrib/spi/moddatetime--unpackaged--1.0.sql b/contrib/spi/moddatetime--unpackaged--1.0.sql
new file mode 100644
index 0000000000..f3a0a96837
--- /dev/null
+++ b/contrib/spi/moddatetime--unpackaged--1.0.sql
@@ -0,0 +1,3 @@
+/* contrib/spi/moddatetime--unpackaged--1.0.sql */
+
+ALTER EXTENSION moddatetime ADD function moddatetime();
diff --git a/contrib/spi/moddatetime.control b/contrib/spi/moddatetime.control
new file mode 100644
index 0000000000..93dfac589a
--- /dev/null
+++ b/contrib/spi/moddatetime.control
@@ -0,0 +1,5 @@
+# moddatetime extension
+comment = 'functions for tracking last modification time'
+default_version = '1.0'
+module_pathname = '$libdir/moddatetime'
+relocatable = true
diff --git a/contrib/spi/moddatetime.sql.in b/contrib/spi/moddatetime.sql.in
deleted file mode 100644
index e4ca6a6653..0000000000
--- a/contrib/spi/moddatetime.sql.in
+++ /dev/null
@@ -1,9 +0,0 @@
-/* contrib/spi/moddatetime.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
-
-CREATE OR REPLACE FUNCTION moddatetime()
-RETURNS trigger
-AS 'MODULE_PATHNAME'
-LANGUAGE C;
diff --git a/contrib/spi/refint.sql.in b/contrib/spi/refint--1.0.sql
index 2525b70006..5a50226c43 100644
--- a/contrib/spi/refint.sql.in
+++ b/contrib/spi/refint--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/spi/refint.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/spi/refint--1.0.sql */
CREATE OR REPLACE FUNCTION check_primary_key()
RETURNS trigger
diff --git a/contrib/spi/refint--unpackaged--1.0.sql b/contrib/spi/refint--unpackaged--1.0.sql
new file mode 100644
index 0000000000..54fece055a
--- /dev/null
+++ b/contrib/spi/refint--unpackaged--1.0.sql
@@ -0,0 +1,4 @@
+/* contrib/spi/refint--unpackaged--1.0.sql */
+
+ALTER EXTENSION refint ADD function check_primary_key();
+ALTER EXTENSION refint ADD function check_foreign_key();
diff --git a/contrib/spi/refint.control b/contrib/spi/refint.control
new file mode 100644
index 0000000000..cbede45784
--- /dev/null
+++ b/contrib/spi/refint.control
@@ -0,0 +1,5 @@
+# refint extension
+comment = 'functions for implementing referential integrity (obsolete)'
+default_version = '1.0'
+module_pathname = '$libdir/refint'
+relocatable = true
diff --git a/contrib/spi/timetravel.sql.in b/contrib/spi/timetravel--1.0.sql
index 83dc958a88..c9f786218f 100644
--- a/contrib/spi/timetravel.sql.in
+++ b/contrib/spi/timetravel--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/spi/timetravel.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/spi/timetravel--1.0.sql */
CREATE OR REPLACE FUNCTION timetravel()
RETURNS trigger
diff --git a/contrib/spi/timetravel--unpackaged--1.0.sql b/contrib/spi/timetravel--unpackaged--1.0.sql
new file mode 100644
index 0000000000..e3716afe95
--- /dev/null
+++ b/contrib/spi/timetravel--unpackaged--1.0.sql
@@ -0,0 +1,5 @@
+/* contrib/spi/timetravel--unpackaged--1.0.sql */
+
+ALTER EXTENSION timetravel ADD function timetravel();
+ALTER EXTENSION timetravel ADD function set_timetravel(name,integer);
+ALTER EXTENSION timetravel ADD function get_timetravel(name);
diff --git a/contrib/spi/timetravel.control b/contrib/spi/timetravel.control
new file mode 100644
index 0000000000..9b4bb6ba04
--- /dev/null
+++ b/contrib/spi/timetravel.control
@@ -0,0 +1,5 @@
+# timetravel extension
+comment = 'functions for implementing time travel'
+default_version = '1.0'
+module_pathname = '$libdir/timetravel'
+relocatable = true
diff --git a/contrib/sslinfo/.gitignore b/contrib/sslinfo/.gitignore
deleted file mode 100644
index 6ed45c8ce5..0000000000
--- a/contrib/sslinfo/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/sslinfo.sql
diff --git a/contrib/sslinfo/Makefile b/contrib/sslinfo/Makefile
index a4c3d84297..0dee6ed2f7 100644
--- a/contrib/sslinfo/Makefile
+++ b/contrib/sslinfo/Makefile
@@ -2,8 +2,9 @@
MODULE_big = sslinfo
OBJS = sslinfo.o
-DATA_built = sslinfo.sql
-DATA = uninstall_sslinfo.sql
+
+EXTENSION = sslinfo
+DATA = sslinfo--1.0.sql sslinfo--unpackaged--1.0.sql
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/sslinfo/sslinfo.sql.in b/contrib/sslinfo/sslinfo--1.0.sql
index 66cbe3ea66..37007e59f7 100644
--- a/contrib/sslinfo/sslinfo.sql.in
+++ b/contrib/sslinfo/sslinfo--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/sslinfo/sslinfo.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/sslinfo/sslinfo--1.0.sql */
CREATE OR REPLACE FUNCTION ssl_client_serial() RETURNS numeric
AS 'MODULE_PATHNAME', 'ssl_client_serial'
diff --git a/contrib/sslinfo/sslinfo--unpackaged--1.0.sql b/contrib/sslinfo/sslinfo--unpackaged--1.0.sql
new file mode 100644
index 0000000000..c07793905a
--- /dev/null
+++ b/contrib/sslinfo/sslinfo--unpackaged--1.0.sql
@@ -0,0 +1,11 @@
+/* contrib/sslinfo/sslinfo--unpackaged--1.0.sql */
+
+ALTER EXTENSION sslinfo ADD function ssl_client_serial();
+ALTER EXTENSION sslinfo ADD function ssl_is_used();
+ALTER EXTENSION sslinfo ADD function ssl_version();
+ALTER EXTENSION sslinfo ADD function ssl_cipher();
+ALTER EXTENSION sslinfo ADD function ssl_client_cert_present();
+ALTER EXTENSION sslinfo ADD function ssl_client_dn_field(text);
+ALTER EXTENSION sslinfo ADD function ssl_issuer_field(text);
+ALTER EXTENSION sslinfo ADD function ssl_client_dn();
+ALTER EXTENSION sslinfo ADD function ssl_issuer_dn();
diff --git a/contrib/sslinfo/sslinfo.control b/contrib/sslinfo/sslinfo.control
new file mode 100644
index 0000000000..1d2f058f6e
--- /dev/null
+++ b/contrib/sslinfo/sslinfo.control
@@ -0,0 +1,5 @@
+# sslinfo extension
+comment = 'information about SSL certificates'
+default_version = '1.0'
+module_pathname = '$libdir/sslinfo'
+relocatable = true
diff --git a/contrib/sslinfo/uninstall_sslinfo.sql b/contrib/sslinfo/uninstall_sslinfo.sql
deleted file mode 100644
index 9ac572c8f9..0000000000
--- a/contrib/sslinfo/uninstall_sslinfo.sql
+++ /dev/null
@@ -1,14 +0,0 @@
-/* contrib/sslinfo/uninstall_sslinfo.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION ssl_client_serial();
-DROP FUNCTION ssl_is_used();
-DROP FUNCTION ssl_cipher();
-DROP FUNCTION ssl_version();
-DROP FUNCTION ssl_client_cert_present();
-DROP FUNCTION ssl_client_dn_field(text);
-DROP FUNCTION ssl_issuer_field(text);
-DROP FUNCTION ssl_client_dn();
-DROP FUNCTION ssl_issuer_dn();
diff --git a/contrib/tablefunc/.gitignore b/contrib/tablefunc/.gitignore
index b28639637b..19b6c5ba42 100644
--- a/contrib/tablefunc/.gitignore
+++ b/contrib/tablefunc/.gitignore
@@ -1,3 +1,2 @@
-/tablefunc.sql
# Generated subdirectories
/results/
diff --git a/contrib/tablefunc/Makefile b/contrib/tablefunc/Makefile
index a5c2882866..eb108931ec 100644
--- a/contrib/tablefunc/Makefile
+++ b/contrib/tablefunc/Makefile
@@ -1,8 +1,10 @@
# contrib/tablefunc/Makefile
MODULES = tablefunc
-DATA_built = tablefunc.sql
-DATA = uninstall_tablefunc.sql
+
+EXTENSION = tablefunc
+DATA = tablefunc--1.0.sql tablefunc--unpackaged--1.0.sql
+
REGRESS = tablefunc
LDFLAGS_SL += $(filter -lm, $(LIBS))
diff --git a/contrib/tablefunc/expected/tablefunc.out b/contrib/tablefunc/expected/tablefunc.out
index 15ef758ed7..7ad4336ada 100644
--- a/contrib/tablefunc/expected/tablefunc.out
+++ b/contrib/tablefunc/expected/tablefunc.out
@@ -1,10 +1,4 @@
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of tablefunc.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION tablefunc;
--
-- normal_rand()
-- no easy way to do this for regression testing
diff --git a/contrib/tablefunc/sql/tablefunc.sql b/contrib/tablefunc/sql/tablefunc.sql
index 8846a4218e..bf874f26ad 100644
--- a/contrib/tablefunc/sql/tablefunc.sql
+++ b/contrib/tablefunc/sql/tablefunc.sql
@@ -1,12 +1,4 @@
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of tablefunc.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i tablefunc.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION tablefunc;
--
-- normal_rand()
diff --git a/contrib/tablefunc/tablefunc.sql.in b/contrib/tablefunc/tablefunc--1.0.sql
index 54cba5ed3e..63dd8c4634 100644
--- a/contrib/tablefunc/tablefunc.sql.in
+++ b/contrib/tablefunc/tablefunc--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/tablefunc/tablefunc.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/tablefunc/tablefunc--1.0.sql */
CREATE OR REPLACE FUNCTION normal_rand(int4, float8, float8)
RETURNS setof float8
diff --git a/contrib/tablefunc/tablefunc--unpackaged--1.0.sql b/contrib/tablefunc/tablefunc--unpackaged--1.0.sql
new file mode 100644
index 0000000000..20e09816e9
--- /dev/null
+++ b/contrib/tablefunc/tablefunc--unpackaged--1.0.sql
@@ -0,0 +1,16 @@
+/* contrib/tablefunc/tablefunc--unpackaged--1.0.sql */
+
+ALTER EXTENSION tablefunc ADD function normal_rand(integer,double precision,double precision);
+ALTER EXTENSION tablefunc ADD function crosstab(text);
+ALTER EXTENSION tablefunc ADD type tablefunc_crosstab_2;
+ALTER EXTENSION tablefunc ADD type tablefunc_crosstab_3;
+ALTER EXTENSION tablefunc ADD type tablefunc_crosstab_4;
+ALTER EXTENSION tablefunc ADD function crosstab2(text);
+ALTER EXTENSION tablefunc ADD function crosstab3(text);
+ALTER EXTENSION tablefunc ADD function crosstab4(text);
+ALTER EXTENSION tablefunc ADD function crosstab(text,integer);
+ALTER EXTENSION tablefunc ADD function crosstab(text,text);
+ALTER EXTENSION tablefunc ADD function connectby(text,text,text,text,integer,text);
+ALTER EXTENSION tablefunc ADD function connectby(text,text,text,text,integer);
+ALTER EXTENSION tablefunc ADD function connectby(text,text,text,text,text,integer,text);
+ALTER EXTENSION tablefunc ADD function connectby(text,text,text,text,text,integer);
diff --git a/contrib/tablefunc/tablefunc.control b/contrib/tablefunc/tablefunc.control
new file mode 100644
index 0000000000..248b0a77a2
--- /dev/null
+++ b/contrib/tablefunc/tablefunc.control
@@ -0,0 +1,5 @@
+# tablefunc extension
+comment = 'functions that manipulate whole tables, including crosstab'
+default_version = '1.0'
+module_pathname = '$libdir/tablefunc'
+relocatable = true
diff --git a/contrib/tablefunc/uninstall_tablefunc.sql b/contrib/tablefunc/uninstall_tablefunc.sql
deleted file mode 100644
index b1ec916447..0000000000
--- a/contrib/tablefunc/uninstall_tablefunc.sql
+++ /dev/null
@@ -1,32 +0,0 @@
-/* contrib/tablefunc/uninstall_tablefunc.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION connectby(text,text,text,text,text,int);
-
-DROP FUNCTION connectby(text,text,text,text,text,int,text);
-
-DROP FUNCTION connectby(text,text,text,text,int);
-
-DROP FUNCTION connectby(text,text,text,text,int,text);
-
-DROP FUNCTION crosstab(text,text);
-
-DROP FUNCTION crosstab(text,int);
-
-DROP FUNCTION crosstab4(text);
-
-DROP FUNCTION crosstab3(text);
-
-DROP FUNCTION crosstab2(text);
-
-DROP TYPE tablefunc_crosstab_4;
-
-DROP TYPE tablefunc_crosstab_3;
-
-DROP TYPE tablefunc_crosstab_2;
-
-DROP FUNCTION crosstab(text);
-
-DROP FUNCTION normal_rand(int4, float8, float8);
diff --git a/contrib/test_parser/.gitignore b/contrib/test_parser/.gitignore
index c07f518855..19b6c5ba42 100644
--- a/contrib/test_parser/.gitignore
+++ b/contrib/test_parser/.gitignore
@@ -1,3 +1,2 @@
-/test_parser.sql
# Generated subdirectories
/results/
diff --git a/contrib/test_parser/Makefile b/contrib/test_parser/Makefile
index ad4e0ec9b8..b9766cb023 100644
--- a/contrib/test_parser/Makefile
+++ b/contrib/test_parser/Makefile
@@ -2,8 +2,10 @@
MODULE_big = test_parser
OBJS = test_parser.o
-DATA_built = test_parser.sql
-DATA = uninstall_test_parser.sql
+
+EXTENSION = test_parser
+DATA = test_parser--1.0.sql test_parser--unpackaged--1.0.sql
+
REGRESS = test_parser
ifdef USE_PGXS
diff --git a/contrib/test_parser/expected/test_parser.out b/contrib/test_parser/expected/test_parser.out
index 3d0fd4210f..8a49bc01e3 100644
--- a/contrib/test_parser/expected/test_parser.out
+++ b/contrib/test_parser/expected/test_parser.out
@@ -1,10 +1,4 @@
---
--- first, define the parser. Turn off echoing so that expected file
--- does not depend on contents of this file.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION test_parser;
-- make test configuration using parser
CREATE TEXT SEARCH CONFIGURATION testcfg (PARSER = testparser);
ALTER TEXT SEARCH CONFIGURATION testcfg ADD MAPPING FOR word WITH simple;
diff --git a/contrib/test_parser/sql/test_parser.sql b/contrib/test_parser/sql/test_parser.sql
index 97c2cb5a5d..1f21504602 100644
--- a/contrib/test_parser/sql/test_parser.sql
+++ b/contrib/test_parser/sql/test_parser.sql
@@ -1,12 +1,4 @@
---
--- first, define the parser. Turn off echoing so that expected file
--- does not depend on contents of this file.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i test_parser.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION test_parser;
-- make test configuration using parser
diff --git a/contrib/test_parser/test_parser.sql.in b/contrib/test_parser/test_parser--1.0.sql
index bab97a2987..fb785a1c4a 100644
--- a/contrib/test_parser/test_parser.sql.in
+++ b/contrib/test_parser/test_parser--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/test_parser/test_parser.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/test_parser/test_parser--1.0.sql */
CREATE OR REPLACE FUNCTION testprs_start(internal, int4)
RETURNS internal
diff --git a/contrib/test_parser/test_parser--unpackaged--1.0.sql b/contrib/test_parser/test_parser--unpackaged--1.0.sql
new file mode 100644
index 0000000000..e240ab2b5b
--- /dev/null
+++ b/contrib/test_parser/test_parser--unpackaged--1.0.sql
@@ -0,0 +1,7 @@
+/* contrib/test_parser/test_parser--unpackaged--1.0.sql */
+
+ALTER EXTENSION test_parser ADD function testprs_start(internal,integer);
+ALTER EXTENSION test_parser ADD function testprs_getlexeme(internal,internal,internal);
+ALTER EXTENSION test_parser ADD function testprs_end(internal);
+ALTER EXTENSION test_parser ADD function testprs_lextype(internal);
+ALTER EXTENSION test_parser ADD text search parser testparser;
diff --git a/contrib/test_parser/test_parser.control b/contrib/test_parser/test_parser.control
new file mode 100644
index 0000000000..36b26b2087
--- /dev/null
+++ b/contrib/test_parser/test_parser.control
@@ -0,0 +1,5 @@
+# test_parser extension
+comment = 'example of a custom parser for full-text search'
+default_version = '1.0'
+module_pathname = '$libdir/test_parser'
+relocatable = true
diff --git a/contrib/test_parser/uninstall_test_parser.sql b/contrib/test_parser/uninstall_test_parser.sql
deleted file mode 100644
index 042f46b251..0000000000
--- a/contrib/test_parser/uninstall_test_parser.sql
+++ /dev/null
@@ -1,14 +0,0 @@
-/* contrib/test_parser/uninstall_test_parser.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP TEXT SEARCH PARSER testparser;
-
-DROP FUNCTION testprs_start(internal, int4);
-
-DROP FUNCTION testprs_getlexeme(internal, internal, internal);
-
-DROP FUNCTION testprs_end(internal);
-
-DROP FUNCTION testprs_lextype(internal);
diff --git a/contrib/tsearch2/.gitignore b/contrib/tsearch2/.gitignore
index 1d34309d00..19b6c5ba42 100644
--- a/contrib/tsearch2/.gitignore
+++ b/contrib/tsearch2/.gitignore
@@ -1,3 +1,2 @@
-/tsearch2.sql
# Generated subdirectories
/results/
diff --git a/contrib/tsearch2/Makefile b/contrib/tsearch2/Makefile
index 8748d30b19..d260fd0030 100644
--- a/contrib/tsearch2/Makefile
+++ b/contrib/tsearch2/Makefile
@@ -1,8 +1,10 @@
# contrib/tsearch2/Makefile
MODULES = tsearch2
-DATA_built = tsearch2.sql
-DATA = uninstall_tsearch2.sql
+
+EXTENSION = tsearch2
+DATA = tsearch2--1.0.sql tsearch2--unpackaged--1.0.sql
+
REGRESS = tsearch2
ifdef USE_PGXS
diff --git a/contrib/tsearch2/expected/tsearch2.out b/contrib/tsearch2/expected/tsearch2.out
index 18b591e0aa..972f764c14 100644
--- a/contrib/tsearch2/expected/tsearch2.out
+++ b/contrib/tsearch2/expected/tsearch2.out
@@ -1,10 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of tsearch2.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION tsearch2;
--tsvector
SELECT '1'::tsvector;
tsvector
diff --git a/contrib/tsearch2/expected/tsearch2_1.out b/contrib/tsearch2/expected/tsearch2_1.out
index f7cb0963b8..349733b6fd 100644
--- a/contrib/tsearch2/expected/tsearch2_1.out
+++ b/contrib/tsearch2/expected/tsearch2_1.out
@@ -1,10 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of tsearch2.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION tsearch2;
--tsvector
SELECT '1'::tsvector;
tsvector
diff --git a/contrib/tsearch2/sql/tsearch2.sql b/contrib/tsearch2/sql/tsearch2.sql
index 99d808a1b3..665882ff88 100644
--- a/contrib/tsearch2/sql/tsearch2.sql
+++ b/contrib/tsearch2/sql/tsearch2.sql
@@ -1,12 +1,4 @@
---
--- first, define the datatype. Turn off echoing so that expected file
--- does not depend on contents of tsearch2.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i tsearch2.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION tsearch2;
--tsvector
SELECT '1'::tsvector;
diff --git a/contrib/tsearch2/tsearch2.sql.in b/contrib/tsearch2/tsearch2--1.0.sql
index f7f7dfdec8..40386a4c2a 100644
--- a/contrib/tsearch2/tsearch2.sql.in
+++ b/contrib/tsearch2/tsearch2--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/tsearch2/tsearch2.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/tsearch2/tsearch2--1.0.sql */
-- These domains are just to catch schema-qualified references to the
-- old data types.
diff --git a/contrib/tsearch2/tsearch2--unpackaged--1.0.sql b/contrib/tsearch2/tsearch2--unpackaged--1.0.sql
new file mode 100644
index 0000000000..a3fcc8572a
--- /dev/null
+++ b/contrib/tsearch2/tsearch2--unpackaged--1.0.sql
@@ -0,0 +1,100 @@
+/* contrib/tsearch2/tsearch2--unpackaged--1.0.sql */
+
+ALTER EXTENSION tsearch2 ADD type @extschema@.tsvector;
+ALTER EXTENSION tsearch2 ADD type @extschema@.tsquery;
+ALTER EXTENSION tsearch2 ADD type @extschema@.gtsvector;
+ALTER EXTENSION tsearch2 ADD type gtsq;
+ALTER EXTENSION tsearch2 ADD function lexize(oid,text);
+ALTER EXTENSION tsearch2 ADD function lexize(text,text);
+ALTER EXTENSION tsearch2 ADD function lexize(text);
+ALTER EXTENSION tsearch2 ADD function set_curdict(integer);
+ALTER EXTENSION tsearch2 ADD function set_curdict(text);
+ALTER EXTENSION tsearch2 ADD function dex_init(internal);
+ALTER EXTENSION tsearch2 ADD function dex_lexize(internal,internal,integer);
+ALTER EXTENSION tsearch2 ADD function snb_en_init(internal);
+ALTER EXTENSION tsearch2 ADD function snb_lexize(internal,internal,integer);
+ALTER EXTENSION tsearch2 ADD function snb_ru_init_koi8(internal);
+ALTER EXTENSION tsearch2 ADD function snb_ru_init_utf8(internal);
+ALTER EXTENSION tsearch2 ADD function snb_ru_init(internal);
+ALTER EXTENSION tsearch2 ADD function spell_init(internal);
+ALTER EXTENSION tsearch2 ADD function spell_lexize(internal,internal,integer);
+ALTER EXTENSION tsearch2 ADD function syn_init(internal);
+ALTER EXTENSION tsearch2 ADD function syn_lexize(internal,internal,integer);
+ALTER EXTENSION tsearch2 ADD function @extschema@.thesaurus_init(internal);
+ALTER EXTENSION tsearch2 ADD function thesaurus_lexize(internal,internal,integer,internal);
+ALTER EXTENSION tsearch2 ADD type tokentype;
+ALTER EXTENSION tsearch2 ADD function token_type(integer);
+ALTER EXTENSION tsearch2 ADD function token_type(text);
+ALTER EXTENSION tsearch2 ADD function token_type();
+ALTER EXTENSION tsearch2 ADD function set_curprs(integer);
+ALTER EXTENSION tsearch2 ADD function set_curprs(text);
+ALTER EXTENSION tsearch2 ADD type tokenout;
+ALTER EXTENSION tsearch2 ADD function parse(oid,text);
+ALTER EXTENSION tsearch2 ADD function parse(text,text);
+ALTER EXTENSION tsearch2 ADD function parse(text);
+ALTER EXTENSION tsearch2 ADD function @extschema@.prsd_start(internal,integer);
+ALTER EXTENSION tsearch2 ADD function prsd_getlexeme(internal,internal,internal);
+ALTER EXTENSION tsearch2 ADD function @extschema@.prsd_end(internal);
+ALTER EXTENSION tsearch2 ADD function @extschema@.prsd_lextype(internal);
+ALTER EXTENSION tsearch2 ADD function prsd_headline(internal,internal,internal);
+ALTER EXTENSION tsearch2 ADD function set_curcfg(integer);
+ALTER EXTENSION tsearch2 ADD function set_curcfg(text);
+ALTER EXTENSION tsearch2 ADD function show_curcfg();
+ALTER EXTENSION tsearch2 ADD function @extschema@.length(tsvector);
+ALTER EXTENSION tsearch2 ADD function to_tsvector(oid,text);
+ALTER EXTENSION tsearch2 ADD function to_tsvector(text,text);
+ALTER EXTENSION tsearch2 ADD function @extschema@.to_tsvector(text);
+ALTER EXTENSION tsearch2 ADD function @extschema@.strip(tsvector);
+ALTER EXTENSION tsearch2 ADD function @extschema@.setweight(tsvector,"char");
+ALTER EXTENSION tsearch2 ADD function concat(tsvector,tsvector);
+ALTER EXTENSION tsearch2 ADD function @extschema@.querytree(tsquery);
+ALTER EXTENSION tsearch2 ADD function to_tsquery(oid,text);
+ALTER EXTENSION tsearch2 ADD function to_tsquery(text,text);
+ALTER EXTENSION tsearch2 ADD function @extschema@.to_tsquery(text);
+ALTER EXTENSION tsearch2 ADD function plainto_tsquery(oid,text);
+ALTER EXTENSION tsearch2 ADD function plainto_tsquery(text,text);
+ALTER EXTENSION tsearch2 ADD function @extschema@.plainto_tsquery(text);
+ALTER EXTENSION tsearch2 ADD function tsearch2();
+ALTER EXTENSION tsearch2 ADD function rank(real[],tsvector,tsquery);
+ALTER EXTENSION tsearch2 ADD function rank(real[],tsvector,tsquery,integer);
+ALTER EXTENSION tsearch2 ADD function rank(tsvector,tsquery);
+ALTER EXTENSION tsearch2 ADD function rank(tsvector,tsquery,integer);
+ALTER EXTENSION tsearch2 ADD function rank_cd(real[],tsvector,tsquery);
+ALTER EXTENSION tsearch2 ADD function rank_cd(real[],tsvector,tsquery,integer);
+ALTER EXTENSION tsearch2 ADD function rank_cd(tsvector,tsquery);
+ALTER EXTENSION tsearch2 ADD function rank_cd(tsvector,tsquery,integer);
+ALTER EXTENSION tsearch2 ADD function headline(oid,text,tsquery,text);
+ALTER EXTENSION tsearch2 ADD function headline(oid,text,tsquery);
+ALTER EXTENSION tsearch2 ADD function headline(text,text,tsquery,text);
+ALTER EXTENSION tsearch2 ADD function headline(text,text,tsquery);
+ALTER EXTENSION tsearch2 ADD function headline(text,tsquery,text);
+ALTER EXTENSION tsearch2 ADD function headline(text,tsquery);
+ALTER EXTENSION tsearch2 ADD operator family gist_tsvector_ops using gist;
+ALTER EXTENSION tsearch2 ADD operator class gist_tsvector_ops using gist;
+ALTER EXTENSION tsearch2 ADD type statinfo;
+ALTER EXTENSION tsearch2 ADD function stat(text);
+ALTER EXTENSION tsearch2 ADD function stat(text,text);
+ALTER EXTENSION tsearch2 ADD function reset_tsearch();
+ALTER EXTENSION tsearch2 ADD function get_covers(tsvector,tsquery);
+ALTER EXTENSION tsearch2 ADD type tsdebug;
+ALTER EXTENSION tsearch2 ADD function _get_parser_from_curcfg();
+ALTER EXTENSION tsearch2 ADD function @extschema@.ts_debug(text);
+ALTER EXTENSION tsearch2 ADD function @extschema@.numnode(tsquery);
+ALTER EXTENSION tsearch2 ADD function @extschema@.tsquery_and(tsquery,tsquery);
+ALTER EXTENSION tsearch2 ADD function @extschema@.tsquery_or(tsquery,tsquery);
+ALTER EXTENSION tsearch2 ADD function @extschema@.tsquery_not(tsquery);
+ALTER EXTENSION tsearch2 ADD function rewrite(tsquery,text);
+ALTER EXTENSION tsearch2 ADD function rewrite(tsquery,tsquery,tsquery);
+ALTER EXTENSION tsearch2 ADD function rewrite_accum(tsquery,tsquery[]);
+ALTER EXTENSION tsearch2 ADD function rewrite_finish(tsquery);
+ALTER EXTENSION tsearch2 ADD function rewrite(tsquery[]);
+ALTER EXTENSION tsearch2 ADD function @extschema@.tsq_mcontains(tsquery,tsquery);
+ALTER EXTENSION tsearch2 ADD function @extschema@.tsq_mcontained(tsquery,tsquery);
+ALTER EXTENSION tsearch2 ADD operator family gist_tp_tsquery_ops using gist;
+ALTER EXTENSION tsearch2 ADD operator class gist_tp_tsquery_ops using gist;
+ALTER EXTENSION tsearch2 ADD operator family gin_tsvector_ops using gin;
+ALTER EXTENSION tsearch2 ADD operator class gin_tsvector_ops using gin;
+ALTER EXTENSION tsearch2 ADD operator family @extschema@.tsvector_ops using btree;
+ALTER EXTENSION tsearch2 ADD operator class @extschema@.tsvector_ops using btree;
+ALTER EXTENSION tsearch2 ADD operator family @extschema@.tsquery_ops using btree;
+ALTER EXTENSION tsearch2 ADD operator class @extschema@.tsquery_ops using btree;
diff --git a/contrib/tsearch2/tsearch2.control b/contrib/tsearch2/tsearch2.control
new file mode 100644
index 0000000000..474fedeada
--- /dev/null
+++ b/contrib/tsearch2/tsearch2.control
@@ -0,0 +1,5 @@
+# tsearch2 extension
+comment = 'compatibility package for pre-8.3 text search functions'
+default_version = '1.0'
+module_pathname = '$libdir/tsearch2'
+relocatable = true
diff --git a/contrib/tsearch2/uninstall_tsearch2.sql b/contrib/tsearch2/uninstall_tsearch2.sql
deleted file mode 100644
index f444a218e6..0000000000
--- a/contrib/tsearch2/uninstall_tsearch2.sql
+++ /dev/null
@@ -1,96 +0,0 @@
-/* contrib/tsearch2/uninstall_tsearch2.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public, pg_catalog;
-
-DROP DOMAIN tsvector CASCADE;
-DROP DOMAIN tsquery CASCADE;
-DROP DOMAIN gtsvector CASCADE;
-DROP DOMAIN gtsq CASCADE;
-
-DROP TYPE tokentype CASCADE;
-DROP TYPE tokenout CASCADE;
-DROP TYPE statinfo CASCADE;
-DROP TYPE tsdebug CASCADE;
-
-DROP OPERATOR CLASS tsquery_ops USING btree CASCADE;
-
-DROP OPERATOR CLASS tsvector_ops USING btree CASCADE;
-
-DROP OPERATOR CLASS gin_tsvector_ops USING gin CASCADE;
-
-DROP OPERATOR CLASS gist_tp_tsquery_ops USING gist CASCADE;
-
-DROP OPERATOR CLASS gist_tsvector_ops USING gist CASCADE;
-
-DROP FUNCTION lexize(oid, text) ;
-DROP FUNCTION lexize(text, text);
-DROP FUNCTION lexize(text);
-DROP FUNCTION set_curdict(int);
-DROP FUNCTION set_curdict(text);
-DROP FUNCTION dex_init(internal);
-DROP FUNCTION dex_lexize(internal,internal,int4);
-DROP FUNCTION snb_en_init(internal);
-DROP FUNCTION snb_lexize(internal,internal,int4);
-DROP FUNCTION snb_ru_init_koi8(internal);
-DROP FUNCTION snb_ru_init_utf8(internal);
-DROP FUNCTION snb_ru_init(internal);
-DROP FUNCTION spell_init(internal);
-DROP FUNCTION spell_lexize(internal,internal,int4);
-DROP FUNCTION syn_init(internal);
-DROP FUNCTION syn_lexize(internal,internal,int4);
-DROP FUNCTION thesaurus_init(internal);
-DROP FUNCTION thesaurus_lexize(internal,internal,int4,internal);
-DROP FUNCTION set_curprs(int);
-DROP FUNCTION set_curprs(text);
-DROP FUNCTION prsd_start(internal,int4);
-DROP FUNCTION prsd_getlexeme(internal,internal,internal);
-DROP FUNCTION prsd_end(internal);
-DROP FUNCTION prsd_lextype(internal);
-DROP FUNCTION prsd_headline(internal,internal,internal);
-DROP FUNCTION set_curcfg(int);
-DROP FUNCTION set_curcfg(text);
-DROP FUNCTION show_curcfg();
-DROP FUNCTION length(tsvector);
-DROP FUNCTION to_tsvector(oid, text);
-DROP FUNCTION to_tsvector(text, text);
-DROP FUNCTION to_tsvector(text);
-DROP FUNCTION strip(tsvector);
-DROP FUNCTION setweight(tsvector,"char");
-DROP FUNCTION concat(tsvector,tsvector);
-DROP FUNCTION querytree(tsquery);
-DROP FUNCTION to_tsquery(oid, text);
-DROP FUNCTION to_tsquery(text, text);
-DROP FUNCTION to_tsquery(text);
-DROP FUNCTION plainto_tsquery(oid, text);
-DROP FUNCTION plainto_tsquery(text, text);
-DROP FUNCTION plainto_tsquery(text);
-DROP FUNCTION tsearch2() CASCADE;
-DROP FUNCTION rank(float4[], tsvector, tsquery);
-DROP FUNCTION rank(float4[], tsvector, tsquery, int4);
-DROP FUNCTION rank(tsvector, tsquery);
-DROP FUNCTION rank(tsvector, tsquery, int4);
-DROP FUNCTION rank_cd(float4[], tsvector, tsquery);
-DROP FUNCTION rank_cd(float4[], tsvector, tsquery, int4);
-DROP FUNCTION rank_cd(tsvector, tsquery);
-DROP FUNCTION rank_cd(tsvector, tsquery, int4);
-DROP FUNCTION headline(oid, text, tsquery, text);
-DROP FUNCTION headline(oid, text, tsquery);
-DROP FUNCTION headline(text, text, tsquery, text);
-DROP FUNCTION headline(text, text, tsquery);
-DROP FUNCTION headline(text, tsquery, text);
-DROP FUNCTION headline(text, tsquery);
-DROP FUNCTION get_covers(tsvector,tsquery);
-DROP FUNCTION _get_parser_from_curcfg();
-DROP FUNCTION numnode(tsquery);
-DROP FUNCTION tsquery_and(tsquery,tsquery);
-DROP FUNCTION tsquery_or(tsquery,tsquery);
-DROP FUNCTION tsquery_not(tsquery);
-DROP FUNCTION rewrite(tsquery, text);
-DROP FUNCTION rewrite(tsquery, tsquery, tsquery);
-DROP AGGREGATE rewrite (tsquery[]);
-DROP FUNCTION rewrite_accum(tsquery,tsquery[]);
-DROP FUNCTION rewrite_finish(tsquery);
-DROP FUNCTION tsq_mcontains(tsquery, tsquery);
-DROP FUNCTION tsq_mcontained(tsquery, tsquery);
-DROP FUNCTION reset_tsearch();
diff --git a/contrib/unaccent/.gitignore b/contrib/unaccent/.gitignore
index 6d74a7617f..19b6c5ba42 100644
--- a/contrib/unaccent/.gitignore
+++ b/contrib/unaccent/.gitignore
@@ -1,3 +1,2 @@
-/unaccent.sql
# Generated subdirectories
/results/
diff --git a/contrib/unaccent/Makefile b/contrib/unaccent/Makefile
index 254155dcca..13cd8538d3 100644
--- a/contrib/unaccent/Makefile
+++ b/contrib/unaccent/Makefile
@@ -3,9 +3,10 @@
MODULE_big = unaccent
OBJS = unaccent.o
-DATA_built = unaccent.sql
-DATA = uninstall_unaccent.sql
+EXTENSION = unaccent
+DATA = unaccent--1.0.sql unaccent--unpackaged--1.0.sql
DATA_TSEARCH = unaccent.rules
+
REGRESS = unaccent
# Adjust REGRESS_OPTS because we need a UTF8 database
diff --git a/contrib/unaccent/expected/unaccent.out b/contrib/unaccent/expected/unaccent.out
index a09e00fe5b..b93105e9c7 100644
--- a/contrib/unaccent/expected/unaccent.out
+++ b/contrib/unaccent/expected/unaccent.out
@@ -1,6 +1,4 @@
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION unaccent;
-- must have a UTF8 database
SELECT getdatabaseencoding();
getdatabaseencoding
diff --git a/contrib/unaccent/sql/unaccent.sql b/contrib/unaccent/sql/unaccent.sql
index ede938d479..310213994f 100644
--- a/contrib/unaccent/sql/unaccent.sql
+++ b/contrib/unaccent/sql/unaccent.sql
@@ -1,8 +1,4 @@
-SET client_min_messages = warning;
-\set ECHO none
-\i unaccent.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION unaccent;
-- must have a UTF8 database
SELECT getdatabaseencoding();
diff --git a/contrib/unaccent/unaccent.sql.in b/contrib/unaccent/unaccent--1.0.sql
index 6d712e7bb8..4dc9c3d9c6 100644
--- a/contrib/unaccent/unaccent.sql.in
+++ b/contrib/unaccent/unaccent--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/unaccent/unaccent.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/unaccent/unaccent--1.0.sql */
CREATE OR REPLACE FUNCTION unaccent(regdictionary, text)
RETURNS text
diff --git a/contrib/unaccent/unaccent--unpackaged--1.0.sql b/contrib/unaccent/unaccent--unpackaged--1.0.sql
new file mode 100644
index 0000000000..7b36d29512
--- /dev/null
+++ b/contrib/unaccent/unaccent--unpackaged--1.0.sql
@@ -0,0 +1,8 @@
+/* contrib/unaccent/unaccent--unpackaged--1.0.sql */
+
+ALTER EXTENSION unaccent ADD function unaccent(regdictionary,text);
+ALTER EXTENSION unaccent ADD function unaccent(text);
+ALTER EXTENSION unaccent ADD function unaccent_init(internal);
+ALTER EXTENSION unaccent ADD function unaccent_lexize(internal,internal,internal,internal);
+ALTER EXTENSION unaccent ADD text search template unaccent;
+ALTER EXTENSION unaccent ADD text search dictionary unaccent;
diff --git a/contrib/unaccent/unaccent.control b/contrib/unaccent/unaccent.control
new file mode 100644
index 0000000000..200d2ae7bb
--- /dev/null
+++ b/contrib/unaccent/unaccent.control
@@ -0,0 +1,5 @@
+# unaccent extension
+comment = 'text search dictionary that removes accents'
+default_version = '1.0'
+module_pathname = '$libdir/unaccent'
+relocatable = true
diff --git a/contrib/unaccent/uninstall_unaccent.sql b/contrib/unaccent/uninstall_unaccent.sql
deleted file mode 100644
index 6879d4f74c..0000000000
--- a/contrib/unaccent/uninstall_unaccent.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-/* contrib/unaccent/uninstall_unaccent.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION unaccent(regdictionary, text);
-DROP FUNCTION unaccent(text);
-DROP TEXT SEARCH DICTIONARY unaccent;
-DROP TEXT SEARCH TEMPLATE unaccent;
-DROP FUNCTION unaccent_init(internal);
-DROP FUNCTION unaccent_lexize(internal,internal,internal,internal);
diff --git a/contrib/uuid-ossp/.gitignore b/contrib/uuid-ossp/.gitignore
deleted file mode 100644
index ece095ad7b..0000000000
--- a/contrib/uuid-ossp/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/uuid-ossp.sql
diff --git a/contrib/uuid-ossp/Makefile b/contrib/uuid-ossp/Makefile
index 77ea87409f..9b2d2e3ff9 100644
--- a/contrib/uuid-ossp/Makefile
+++ b/contrib/uuid-ossp/Makefile
@@ -2,8 +2,9 @@
MODULE_big = uuid-ossp
OBJS = uuid-ossp.o
-DATA_built = uuid-ossp.sql
-DATA = uninstall_uuid-ossp.sql
+
+EXTENSION = uuid-ossp
+DATA = uuid-ossp--1.0.sql uuid-ossp--unpackaged--1.0.sql
SHLIB_LINK += $(OSSP_UUID_LIBS)
diff --git a/contrib/uuid-ossp/uninstall_uuid-ossp.sql b/contrib/uuid-ossp/uninstall_uuid-ossp.sql
deleted file mode 100644
index 0fafb2721f..0000000000
--- a/contrib/uuid-ossp/uninstall_uuid-ossp.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-/* contrib/uuid-ossp/uninstall_uuid-ossp.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION uuid_nil();
-DROP FUNCTION uuid_ns_dns();
-DROP FUNCTION uuid_ns_url();
-DROP FUNCTION uuid_ns_oid();
-DROP FUNCTION uuid_ns_x500();
-
-DROP FUNCTION uuid_generate_v1();
-DROP FUNCTION uuid_generate_v1mc();
-DROP FUNCTION uuid_generate_v3(namespace uuid, name text);
-DROP FUNCTION uuid_generate_v4();
-DROP FUNCTION uuid_generate_v5(namespace uuid, name text);
diff --git a/contrib/uuid-ossp/uuid-ossp.sql.in b/contrib/uuid-ossp/uuid-ossp--1.0.sql
index 71212cde48..34b32de77e 100644
--- a/contrib/uuid-ossp/uuid-ossp.sql.in
+++ b/contrib/uuid-ossp/uuid-ossp--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/uuid-ossp/uuid-ossp.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/uuid-ossp/uuid-ossp--1.0.sql */
CREATE OR REPLACE FUNCTION uuid_nil()
RETURNS uuid
diff --git a/contrib/uuid-ossp/uuid-ossp--unpackaged--1.0.sql b/contrib/uuid-ossp/uuid-ossp--unpackaged--1.0.sql
new file mode 100644
index 0000000000..bc984dd8c0
--- /dev/null
+++ b/contrib/uuid-ossp/uuid-ossp--unpackaged--1.0.sql
@@ -0,0 +1,12 @@
+/* contrib/uuid-ossp/uuid-ossp--unpackaged--1.0.sql */
+
+ALTER EXTENSION "uuid-ossp" ADD function uuid_nil();
+ALTER EXTENSION "uuid-ossp" ADD function uuid_ns_dns();
+ALTER EXTENSION "uuid-ossp" ADD function uuid_ns_url();
+ALTER EXTENSION "uuid-ossp" ADD function uuid_ns_oid();
+ALTER EXTENSION "uuid-ossp" ADD function uuid_ns_x500();
+ALTER EXTENSION "uuid-ossp" ADD function uuid_generate_v1();
+ALTER EXTENSION "uuid-ossp" ADD function uuid_generate_v1mc();
+ALTER EXTENSION "uuid-ossp" ADD function uuid_generate_v3(namespace uuid, name text);
+ALTER EXTENSION "uuid-ossp" ADD function uuid_generate_v4();
+ALTER EXTENSION "uuid-ossp" ADD function uuid_generate_v5(namespace uuid, name text);
diff --git a/contrib/uuid-ossp/uuid-ossp.control b/contrib/uuid-ossp/uuid-ossp.control
new file mode 100644
index 0000000000..f52ae99d41
--- /dev/null
+++ b/contrib/uuid-ossp/uuid-ossp.control
@@ -0,0 +1,5 @@
+# uuid-ossp extension
+comment = 'generate universally unique identifiers (UUIDs)'
+default_version = '1.0'
+module_pathname = '$libdir/uuid-ossp'
+relocatable = true
diff --git a/contrib/xml2/.gitignore b/contrib/xml2/.gitignore
index 5ef9dbf4d4..19b6c5ba42 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 57b4cbfac5..ad325723c9 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 8ce04d0b84..3bf676fb40 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 d2d243ada7..fda626e08c 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 5b3cc997f5..4a996af716 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 1696390f80..0000000000
--- 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 8c3d420afd..100f57291f 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 0000000000..a4716cf916
--- /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 0000000000..004649d652
--- /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