/* contrib/adminpack/adminpack--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION adminpack" to load this file. \quit
+
/* ***********************************************
* Administrative functions for PostgreSQL
* *********************************************** */
/* contrib/btree_gin/btree_gin--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION btree_gin" to load this file. \quit
+
CREATE FUNCTION gin_btree_consistent(internal, int2, anyelement, int4, internal, internal)
RETURNS bool
AS 'MODULE_PATHNAME'
/* contrib/btree_gin/btree_gin--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION btree_gin" to load this file. \quit
+
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);
/* contrib/btree_gist/btree_gist--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION btree_gist" to load this file. \quit
+
CREATE FUNCTION gbtreekey4_in(cstring)
RETURNS gbtreekey4
AS 'MODULE_PATHNAME', 'gbtreekey_in'
/* contrib/btree_gist/btree_gist--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION btree_gist" to load this file. \quit
+
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);
/* contrib/chkpass/chkpass--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION chkpass" to load this file. \quit
+
--
-- Input and output functions and the type itself:
--
/* contrib/chkpass/chkpass--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION chkpass" to load this file. \quit
+
ALTER EXTENSION chkpass ADD type chkpass;
ALTER EXTENSION chkpass ADD function chkpass_in(cstring);
ALTER EXTENSION chkpass ADD function chkpass_out(chkpass);
/* contrib/citext/citext--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION citext" to load this file. \quit
+
--
-- PostgreSQL code for CITEXT.
--
/* contrib/citext/citext--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION citext" to load this file. \quit
+
ALTER EXTENSION citext ADD type citext;
ALTER EXTENSION citext ADD function citextin(cstring);
ALTER EXTENSION citext ADD function citextout(citext);
/* contrib/cube/cube--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION cube" to load this file. \quit
+
-- Create the user-defined type for N-dimensional boxes
CREATE FUNCTION cube_in(cstring)
/* contrib/cube/cube--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION cube" to load this file. \quit
+
ALTER EXTENSION cube ADD type cube;
ALTER EXTENSION cube ADD function cube_in(cstring);
ALTER EXTENSION cube ADD function cube(double precision[],double precision[]);
/* contrib/dblink/dblink--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION dblink" to load this file. \quit
+
-- dblink_connect now restricts non-superusers to password
-- authenticated connections
CREATE FUNCTION dblink_connect (text)
/* contrib/dblink/dblink--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION dblink" to load this file. \quit
+
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);
/* contrib/dict_int/dict_int--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION dict_int" to load this file. \quit
+
CREATE FUNCTION dintdict_init(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
/* contrib/dict_int/dict_int--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION dict_int" to load this file. \quit
+
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;
/* contrib/dict_xsyn/dict_xsyn--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION dict_xsyn" to load this file. \quit
+
CREATE FUNCTION dxsyn_init(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
/* contrib/dict_xsyn/dict_xsyn--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION dict_xsyn" to load this file. \quit
+
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;
/* contrib/earthdistance/earthdistance--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION earthdistance" to load this file. \quit
+
-- 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
-- in order to use different units (or a better value for the Earth's radius).
/* contrib/earthdistance/earthdistance--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION earthdistance" to load this file. \quit
+
ALTER EXTENSION earthdistance ADD function earth();
ALTER EXTENSION earthdistance ADD type earth;
ALTER EXTENSION earthdistance ADD function sec_to_gc(double precision);
/* contrib/file_fdw/file_fdw--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION file_fdw" to load this file. \quit
+
CREATE FUNCTION file_fdw_handler()
RETURNS fdw_handler
AS 'MODULE_PATHNAME'
/* contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
+
CREATE FUNCTION levenshtein (text,text) RETURNS int
AS 'MODULE_PATHNAME','levenshtein'
LANGUAGE C IMMUTABLE STRICT;
/* contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION fuzzystrmatch" to load this file. \quit
+
ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text);
ALTER EXTENSION fuzzystrmatch ADD function levenshtein(text,text,integer,integer,integer);
ALTER EXTENSION fuzzystrmatch ADD function metaphone(text,integer);
/* contrib/hstore/hstore--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION hstore" to load this file. \quit
+
CREATE TYPE hstore;
CREATE FUNCTION hstore_in(cstring)
/* contrib/hstore/hstore--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION hstore" to load this file. \quit
+
ALTER EXTENSION hstore ADD type hstore;
ALTER EXTENSION hstore ADD function hstore_in(cstring);
ALTER EXTENSION hstore ADD function hstore_out(hstore);
/* contrib/intagg/intagg--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION intagg" to load this file. \quit
+
-- Internal function for the aggregate
-- Is called for each item in an aggregation
CREATE FUNCTION int_agg_state (internal, int4)
/* contrib/intagg/intagg--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION intagg" to load this file. \quit
+
ALTER EXTENSION intagg ADD function int_agg_state(internal,integer);
ALTER EXTENSION intagg ADD function int_agg_final_array(internal);
ALTER EXTENSION intagg ADD function int_array_aggregate(integer);
/* contrib/intarray/intarray--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION intarray" to load this file. \quit
+
--
-- Create the user-defined type for the 1-D integer arrays (_int4)
--
/* contrib/intarray/intarray--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION intarray" to load this file. \quit
+
ALTER EXTENSION intarray ADD type query_int;
ALTER EXTENSION intarray ADD function bqarr_in(cstring);
ALTER EXTENSION intarray ADD function bqarr_out(query_int);
/* contrib/isn/isn--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION isn" to load this file. \quit
+
-- Example:
-- create table test ( id isbn );
-- insert into test values('978-0-393-04002-9');
/* contrib/isn/isn--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION isn" to load this file. \quit
+
ALTER EXTENSION isn ADD type ean13;
ALTER EXTENSION isn ADD function ean13_in(cstring);
ALTER EXTENSION isn ADD function ean13_out(ean13);
/* contrib/lo/lo--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION lo" to load this file. \quit
+
--
-- Create the data type ... now just a domain over OID
--
/* contrib/lo/lo--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION lo" to load this file. \quit
+
ALTER EXTENSION lo ADD domain lo;
ALTER EXTENSION lo ADD function lo_oid(lo);
ALTER EXTENSION lo ADD function lo_manage();
/* contrib/ltree/ltree--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION ltree" to load this file. \quit
+
CREATE FUNCTION ltree_in(cstring)
RETURNS ltree
AS 'MODULE_PATHNAME'
/* contrib/ltree/ltree--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION ltree" to load this file. \quit
+
ALTER EXTENSION ltree ADD type ltree;
ALTER EXTENSION ltree ADD function ltree_in(cstring);
ALTER EXTENSION ltree ADD function ltree_out(ltree);
/* contrib/pageinspect/pageinspect--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pageinspect" to load this file. \quit
+
--
-- get_raw_page()
--
/* contrib/pageinspect/pageinspect--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pageinspect" to load this file. \quit
+
DROP FUNCTION heap_page_items(bytea);
CREATE FUNCTION heap_page_items(IN page bytea,
OUT lp smallint,
/* contrib/pg_buffercache/pg_buffercache--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pg_buffercache" to load this file. \quit
+
-- Register the function.
CREATE FUNCTION pg_buffercache_pages()
RETURNS SETOF RECORD
/* contrib/pg_buffercache/pg_buffercache--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pg_buffercache" to load this file. \quit
+
ALTER EXTENSION pg_buffercache ADD function pg_buffercache_pages();
ALTER EXTENSION pg_buffercache ADD view pg_buffercache;
/* contrib/pg_freespacemap/pg_freespacemap--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pg_freespacemap" to load this file. \quit
+
-- Register the C function.
CREATE FUNCTION pg_freespace(regclass, bigint)
RETURNS int2
/* contrib/pg_freespacemap/pg_freespacemap--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pg_freespacemap" to load this file. \quit
+
ALTER EXTENSION pg_freespacemap ADD function pg_freespace(regclass,bigint);
ALTER EXTENSION pg_freespacemap ADD function pg_freespace(regclass);
/* contrib/pg_stat_statements/pg_stat_statements--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pg_stat_statements" to load this file. \quit
+
-- Register functions.
CREATE FUNCTION pg_stat_statements_reset()
RETURNS void
/* contrib/pg_stat_statements/pg_stat_statements--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pg_stat_statements" to load this file. \quit
+
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;
/* contrib/pg_trgm/pg_trgm--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pg_trgm" to load this file. \quit
+
CREATE FUNCTION set_limit(float4)
RETURNS float4
AS 'MODULE_PATHNAME'
/* contrib/pg_trgm/pg_trgm--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pg_trgm" to load this file. \quit
+
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);
/* contrib/pgcrypto/pgcrypto--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pgcrypto" to load this file. \quit
+
CREATE FUNCTION digest(text, text)
RETURNS bytea
AS 'MODULE_PATHNAME', 'pg_digest'
/* contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pgcrypto" to load this file. \quit
+
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);
/* contrib/pgrowlocks/pgrowlocks--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pgrowlocks" to load this file. \quit
+
CREATE FUNCTION pgrowlocks(IN relname text,
OUT locked_row TID, -- row TID
OUT lock_type TEXT, -- lock type
/* contrib/pgrowlocks/pgrowlocks--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pgrowlocks" to load this file. \quit
+
ALTER EXTENSION pgrowlocks ADD function pgrowlocks(text);
/* contrib/pgstattuple/pgstattuple--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pgstattuple" to load this file. \quit
+
CREATE FUNCTION pgstattuple(IN relname text,
OUT table_len BIGINT, -- physical table length in bytes
OUT tuple_count BIGINT, -- number of live tuples
/* contrib/pgstattuple/pgstattuple--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pgstattuple" to load this file. \quit
+
ALTER EXTENSION pgstattuple ADD function pgstattuple(text);
ALTER EXTENSION pgstattuple ADD function pgstattuple(oid);
ALTER EXTENSION pgstattuple ADD function pgstatindex(text);
/* contrib/seg/seg--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION seg" to load this file. \quit
+
-- Create the user-defined type for 1-D floating point intervals (seg)
CREATE FUNCTION seg_in(cstring)
/* contrib/seg/seg--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION seg" to load this file. \quit
+
ALTER EXTENSION seg ADD type seg;
ALTER EXTENSION seg ADD function seg_in(cstring);
ALTER EXTENSION seg ADD function seg_out(seg);
/* contrib/spi/autoinc--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION autoinc" to load this file. \quit
+
CREATE FUNCTION autoinc()
RETURNS trigger
AS 'MODULE_PATHNAME'
/* contrib/spi/autoinc--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION autoinc" to load this file. \quit
+
ALTER EXTENSION autoinc ADD function autoinc();
/* contrib/spi/insert_username--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION insert_username" to load this file. \quit
+
CREATE FUNCTION insert_username()
RETURNS trigger
AS 'MODULE_PATHNAME'
/* contrib/spi/insert_username--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION insert_username" to load this file. \quit
+
ALTER EXTENSION insert_username ADD function insert_username();
/* contrib/spi/moddatetime--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION moddatetime" to load this file. \quit
+
CREATE FUNCTION moddatetime()
RETURNS trigger
AS 'MODULE_PATHNAME'
/* contrib/spi/moddatetime--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION moddatetime" to load this file. \quit
+
ALTER EXTENSION moddatetime ADD function moddatetime();
/* contrib/spi/refint--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION refint" to load this file. \quit
+
CREATE FUNCTION check_primary_key()
RETURNS trigger
AS 'MODULE_PATHNAME'
/* contrib/spi/refint--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION refint" to load this file. \quit
+
ALTER EXTENSION refint ADD function check_primary_key();
ALTER EXTENSION refint ADD function check_foreign_key();
/* contrib/spi/timetravel--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION timetravel" to load this file. \quit
+
CREATE FUNCTION timetravel()
RETURNS trigger
AS 'MODULE_PATHNAME'
/* contrib/spi/timetravel--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION timetravel" to load this file. \quit
+
ALTER EXTENSION timetravel ADD function timetravel();
ALTER EXTENSION timetravel ADD function set_timetravel(name,integer);
ALTER EXTENSION timetravel ADD function get_timetravel(name);
/* contrib/sslinfo/sslinfo--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION sslinfo" to load this file. \quit
+
CREATE FUNCTION ssl_client_serial() RETURNS numeric
AS 'MODULE_PATHNAME', 'ssl_client_serial'
LANGUAGE C STRICT;
/* contrib/sslinfo/sslinfo--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION sslinfo" to load this file. \quit
+
ALTER EXTENSION sslinfo ADD function ssl_client_serial();
ALTER EXTENSION sslinfo ADD function ssl_is_used();
ALTER EXTENSION sslinfo ADD function ssl_client_cert_present();
/* contrib/tablefunc/tablefunc--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION tablefunc" to load this file. \quit
+
CREATE FUNCTION normal_rand(int4, float8, float8)
RETURNS setof float8
AS 'MODULE_PATHNAME','normal_rand'
/* contrib/tablefunc/tablefunc--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION tablefunc" to load this file. \quit
+
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;
/* contrib/test_parser/test_parser--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION test_parser" to load this file. \quit
+
CREATE FUNCTION testprs_start(internal, int4)
RETURNS internal
AS 'MODULE_PATHNAME'
/* contrib/test_parser/test_parser--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION test_parser" to load this file. \quit
+
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);
/* contrib/tsearch2/tsearch2--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION tsearch2" to load this file. \quit
+
-- These domains are just to catch schema-qualified references to the
-- old data types.
CREATE DOMAIN tsvector AS pg_catalog.tsvector;
/* contrib/tsearch2/tsearch2--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION tsearch2" to load this file. \quit
+
ALTER EXTENSION tsearch2 ADD type @extschema@.tsvector;
ALTER EXTENSION tsearch2 ADD type @extschema@.tsquery;
ALTER EXTENSION tsearch2 ADD type @extschema@.gtsvector;
/* contrib/unaccent/unaccent--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION unaccent" to load this file. \quit
+
CREATE FUNCTION unaccent(regdictionary, text)
RETURNS text
AS 'MODULE_PATHNAME', 'unaccent_dict'
/* contrib/unaccent/unaccent--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION unaccent" to load this file. \quit
+
ALTER EXTENSION unaccent ADD function unaccent(regdictionary,text);
ALTER EXTENSION unaccent ADD function unaccent(text);
ALTER EXTENSION unaccent ADD function unaccent_init(internal);
/* contrib/uuid-ossp/uuid-ossp--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION uuid-ossp" to load this file. \quit
+
CREATE FUNCTION uuid_nil()
RETURNS uuid
AS 'MODULE_PATHNAME', 'uuid_nil'
/* contrib/uuid-ossp/uuid-ossp--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION uuid-ossp" to load this file. \quit
+
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();
/* contrib/xml2/xml2--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION xml2" to load this file. \quit
+
--SQL for XML parser
-- deprecated old name for xml_is_well_formed
/* contrib/xml2/xml2--unpackaged--1.0.sql */
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION xml2" to load this file. \quit
+
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);
script files are implicitly executed within a transaction block.
</para>
+ <para>
+ An extension's <acronym>SQL</> script files can also contain lines
+ beginning with <literal>\echo</>, which will be ignored (treated as
+ comments) by the extension mechanism. This provision is commonly used
+ to throw an error if the script file is fed to <application>psql</>
+ rather than being loaded via <command>CREATE EXTENSION</> (see example
+ script below). Without that, users might accidentally load the
+ extension's contents as <quote>loose</> objects rather than as an
+ extension, a state of affairs that's a bit tedious to recover from.
+ </para>
+
<para>
While the script files can contain any characters allowed by the specified
encoding, control files should contain only plain ASCII, because there
The script file <filename>pair--1.0.sql</> looks like this:
<programlisting><![CDATA[
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION pair" to load this file. \quit
+
CREATE TYPE pair AS ( k text, v text );
CREATE OR REPLACE FUNCTION pair(anyelement, text)
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/objectaccess.h"
+#include "catalog/pg_collation.h"
#include "catalog/pg_depend.h"
#include "catalog/pg_extension.h"
#include "catalog/pg_namespace.h"
CurrentExtensionObject = extensionOid;
PG_TRY();
{
- char *sql = read_extension_script_file(control, filename);
+ char *c_sql = read_extension_script_file(control, filename);
+ Datum t_sql;
+
+ /* We use various functions that want to operate on text datums */
+ t_sql = CStringGetTextDatum(c_sql);
+
+ /*
+ * Reduce any lines beginning with "\echo" to empty. This allows
+ * scripts to contain messages telling people not to run them via
+ * psql, which has been found to be necessary due to old habits.
+ */
+ t_sql = DirectFunctionCall4Coll(textregexreplace,
+ C_COLLATION_OID,
+ t_sql,
+ CStringGetTextDatum("^\\\\echo.*$"),
+ CStringGetTextDatum(""),
+ CStringGetTextDatum("ng"));
/*
* If it's not relocatable, substitute the target schema name for
* occcurrences of @extschema@.
*
- * For a relocatable extension, we just run the script as-is. There
- * cannot be any need for @extschema@, else it wouldn't be
- * relocatable.
+ * For a relocatable extension, we needn't do this. There cannot be
+ * any need for @extschema@, else it wouldn't be relocatable.
*/
if (!control->relocatable)
{
const char *qSchemaName = quote_identifier(schemaName);
- sql = text_to_cstring(
- DatumGetTextPP(
- DirectFunctionCall3(replace_text,
- CStringGetTextDatum(sql),
- CStringGetTextDatum("@extschema@"),
- CStringGetTextDatum(qSchemaName))));
+ t_sql = DirectFunctionCall3(replace_text,
+ t_sql,
+ CStringGetTextDatum("@extschema@"),
+ CStringGetTextDatum(qSchemaName));
}
/*
*/
if (control->module_pathname)
{
- sql = text_to_cstring(
- DatumGetTextPP(
- DirectFunctionCall3(replace_text,
- CStringGetTextDatum(sql),
- CStringGetTextDatum("MODULE_PATHNAME"),
- CStringGetTextDatum(control->module_pathname))));
+ t_sql = DirectFunctionCall3(replace_text,
+ t_sql,
+ CStringGetTextDatum("MODULE_PATHNAME"),
+ CStringGetTextDatum(control->module_pathname));
}
- execute_sql_string(sql, filename);
+ /* And now back to C string */
+ c_sql = text_to_cstring(DatumGetTextPP(t_sql));
+
+ execute_sql_string(c_sql, filename);
}
PG_CATCH();
{