]> granicus.if.org Git - postgresql/commit
Throw a useful error message if an extension script file is fed to psql.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 12 Oct 2011 19:45:03 +0000 (15:45 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 12 Oct 2011 19:45:03 +0000 (15:45 -0400)
commit458857cc9d7d00711b272a0dabbcb591b506d6b8
tree2b4acca78ee2fba19273d10aa01eccc4bc111d4b
parente0d273500a84ab94c69cbfa10ea0537604fbdda3
Throw a useful error message if an extension script file is fed to psql.

We have seen one too many reports of people trying to use 9.1 extension
files in the old-fashioned way of sourcing them in psql.  Not only does
that usually not work (due to failure to substitute for MODULE_PATHNAME
and/or @extschema@), but if it did work they'd get a collection of loose
objects not an extension.  To prevent this, insert an \echo ... \quit
line that prints a suitable error message into each extension script file,
and teach commands/extension.c to ignore lines starting with \echo.
That should not only prevent any adverse consequences of loading a script
file the wrong way, but make it crystal clear to users that they need to
do it differently now.

Tom Lane, following an idea of Andrew Dunstan's.  Back-patch into 9.1
... there is not going to be much value in this if we wait till 9.2.
78 files changed:
contrib/adminpack/adminpack--1.0.sql
contrib/btree_gin/btree_gin--1.0.sql
contrib/btree_gin/btree_gin--unpackaged--1.0.sql
contrib/btree_gist/btree_gist--1.0.sql
contrib/btree_gist/btree_gist--unpackaged--1.0.sql
contrib/chkpass/chkpass--1.0.sql
contrib/chkpass/chkpass--unpackaged--1.0.sql
contrib/citext/citext--1.0.sql
contrib/citext/citext--unpackaged--1.0.sql
contrib/cube/cube--1.0.sql
contrib/cube/cube--unpackaged--1.0.sql
contrib/dblink/dblink--1.0.sql
contrib/dblink/dblink--unpackaged--1.0.sql
contrib/dict_int/dict_int--1.0.sql
contrib/dict_int/dict_int--unpackaged--1.0.sql
contrib/dict_xsyn/dict_xsyn--1.0.sql
contrib/dict_xsyn/dict_xsyn--unpackaged--1.0.sql
contrib/earthdistance/earthdistance--1.0.sql
contrib/earthdistance/earthdistance--unpackaged--1.0.sql
contrib/file_fdw/file_fdw--1.0.sql
contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
contrib/hstore/hstore--1.0.sql
contrib/hstore/hstore--unpackaged--1.0.sql
contrib/intagg/intagg--1.0.sql
contrib/intagg/intagg--unpackaged--1.0.sql
contrib/intarray/intarray--1.0.sql
contrib/intarray/intarray--unpackaged--1.0.sql
contrib/isn/isn--1.0.sql
contrib/isn/isn--unpackaged--1.0.sql
contrib/lo/lo--1.0.sql
contrib/lo/lo--unpackaged--1.0.sql
contrib/ltree/ltree--1.0.sql
contrib/ltree/ltree--unpackaged--1.0.sql
contrib/pageinspect/pageinspect--1.0.sql
contrib/pageinspect/pageinspect--unpackaged--1.0.sql
contrib/pg_buffercache/pg_buffercache--1.0.sql
contrib/pg_buffercache/pg_buffercache--unpackaged--1.0.sql
contrib/pg_freespacemap/pg_freespacemap--1.0.sql
contrib/pg_freespacemap/pg_freespacemap--unpackaged--1.0.sql
contrib/pg_stat_statements/pg_stat_statements--1.0.sql
contrib/pg_stat_statements/pg_stat_statements--unpackaged--1.0.sql
contrib/pg_trgm/pg_trgm--1.0.sql
contrib/pg_trgm/pg_trgm--unpackaged--1.0.sql
contrib/pgcrypto/pgcrypto--1.0.sql
contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql
contrib/pgrowlocks/pgrowlocks--1.0.sql
contrib/pgrowlocks/pgrowlocks--unpackaged--1.0.sql
contrib/pgstattuple/pgstattuple--1.0.sql
contrib/pgstattuple/pgstattuple--unpackaged--1.0.sql
contrib/seg/seg--1.0.sql
contrib/seg/seg--unpackaged--1.0.sql
contrib/spi/autoinc--1.0.sql
contrib/spi/autoinc--unpackaged--1.0.sql
contrib/spi/insert_username--1.0.sql
contrib/spi/insert_username--unpackaged--1.0.sql
contrib/spi/moddatetime--1.0.sql
contrib/spi/moddatetime--unpackaged--1.0.sql
contrib/spi/refint--1.0.sql
contrib/spi/refint--unpackaged--1.0.sql
contrib/spi/timetravel--1.0.sql
contrib/spi/timetravel--unpackaged--1.0.sql
contrib/sslinfo/sslinfo--1.0.sql
contrib/sslinfo/sslinfo--unpackaged--1.0.sql
contrib/tablefunc/tablefunc--1.0.sql
contrib/tablefunc/tablefunc--unpackaged--1.0.sql
contrib/test_parser/test_parser--1.0.sql
contrib/test_parser/test_parser--unpackaged--1.0.sql
contrib/tsearch2/tsearch2--1.0.sql
contrib/tsearch2/tsearch2--unpackaged--1.0.sql
contrib/unaccent/unaccent--1.0.sql
contrib/unaccent/unaccent--unpackaged--1.0.sql
contrib/uuid-ossp/uuid-ossp--1.0.sql
contrib/uuid-ossp/uuid-ossp--unpackaged--1.0.sql
contrib/xml2/xml2--1.0.sql
contrib/xml2/xml2--unpackaged--1.0.sql
doc/src/sgml/extend.sgml
src/backend/commands/extension.c