Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit458857c

Browse files
committed
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 extensionfiles in the old-fashioned way of sourcing them in psql. Not only doesthat usually not work (due to failure to substitute for MODULE_PATHNAMEand/or @extschema@), but if it did work they'd get a collection of looseobjects not an extension. To prevent this, insert an \echo ... \quitline 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 scriptfile the wrong way, but make it crystal clear to users that they need todo 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.
1 parente0d2735 commit458857c

File tree

78 files changed

+274
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+274
-17
lines changed

‎contrib/adminpack/adminpack--1.0.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* contrib/adminpack/adminpack--1.0.sql*/
22

3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use"CREATE EXTENSION adminpack" to load this file. \quit
5+
36
/* ***********************************************
47
* Administrative functions for PostgreSQL
58
* ************************************************/

‎contrib/btree_gin/btree_gin--1.0.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* contrib/btree_gin/btree_gin--1.0.sql*/
22

3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use"CREATE EXTENSION btree_gin" to load this file. \quit
5+
36
CREATEFUNCTIONgin_btree_consistent(internal, int2, anyelement, int4, internal, internal)
47
RETURNS bool
58
AS'MODULE_PATHNAME'

‎contrib/btree_gin/btree_gin--unpackaged--1.0.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* contrib/btree_gin/btree_gin--unpackaged--1.0.sql*/
22

3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use"CREATE EXTENSION btree_gin" to load this file. \quit
5+
36
ALTER EXTENSION btree_gin ADD function gin_btree_consistent(internal,smallint,anyelement,integer,internal,internal);
47
ALTER EXTENSION btree_gin ADD function gin_extract_value_int2(smallint,internal);
58
ALTER EXTENSION btree_gin ADD function gin_compare_prefix_int2(smallint,smallint,smallint,internal);

‎contrib/btree_gist/btree_gist--1.0.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* contrib/btree_gist/btree_gist--1.0.sql*/
22

3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use"CREATE EXTENSION btree_gist" to load this file. \quit
5+
36
CREATEFUNCTIONgbtreekey4_in(cstring)
47
RETURNS gbtreekey4
58
AS'MODULE_PATHNAME','gbtreekey_in'

‎contrib/btree_gist/btree_gist--unpackaged--1.0.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* contrib/btree_gist/btree_gist--unpackaged--1.0.sql*/
22

3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use"CREATE EXTENSION btree_gist" to load this file. \quit
5+
36
ALTER EXTENSION btree_gist ADD type gbtreekey4;
47
ALTER EXTENSION btree_gist ADD function gbtreekey4_in(cstring);
58
ALTER EXTENSION btree_gist ADD function gbtreekey4_out(gbtreekey4);

‎contrib/chkpass/chkpass--1.0.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* contrib/chkpass/chkpass--1.0.sql*/
22

3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use"CREATE EXTENSION chkpass" to load this file. \quit
5+
36
--
47
--Input and output functions and the type itself:
58
--

‎contrib/chkpass/chkpass--unpackaged--1.0.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* contrib/chkpass/chkpass--unpackaged--1.0.sql*/
22

3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use"CREATE EXTENSION chkpass" to load this file. \quit
5+
36
ALTER EXTENSION chkpass ADD type chkpass;
47
ALTER EXTENSION chkpass ADD function chkpass_in(cstring);
58
ALTER EXTENSION chkpass ADD function chkpass_out(chkpass);

‎contrib/citext/citext--1.0.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* contrib/citext/citext--1.0.sql*/
22

3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use"CREATE EXTENSION citext" to load this file. \quit
5+
36
--
47
-- PostgreSQL code for CITEXT.
58
--

‎contrib/citext/citext--unpackaged--1.0.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* contrib/citext/citext--unpackaged--1.0.sql*/
22

3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use"CREATE EXTENSION citext" to load this file. \quit
5+
36
ALTER EXTENSION citext ADD type citext;
47
ALTER EXTENSION citext ADD function citextin(cstring);
58
ALTER EXTENSION citext ADD function citextout(citext);

‎contrib/cube/cube--1.0.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* contrib/cube/cube--1.0.sql*/
22

3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use"CREATE EXTENSION cube" to load this file. \quit
5+
36
-- Create the user-defined type for N-dimensional boxes
47

58
CREATEFUNCTIONcube_in(cstring)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp