1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Avoid use of CREATE OR REPLACE FUNCTION in extension installation files.

It was never terribly consistent to use OR REPLACE (because of the lack of
comparable functionality for data types, operators, etc), and
experimentation shows that it's now positively pernicious in the extension
world.  We really want a failure to occur if there are any conflicts, else
it's unclear what the extension-ownership state of the conflicted object
ought to be.  Most of the time, CREATE EXTENSION will fail anyway because
of conflicts on other object types, but an extension defining only
functions can succeed, with bad results.
This commit is contained in:
Tom Lane
2011-02-13 21:24:14 -05:00
parent 629b3af27d
commit 029fac2264
37 changed files with 922 additions and 922 deletions

View File

@ -6,27 +6,27 @@
/* generic file access functions */
CREATE OR REPLACE FUNCTION pg_catalog.pg_file_write(text, text, bool)
CREATE FUNCTION pg_catalog.pg_file_write(text, text, bool)
RETURNS bigint
AS 'MODULE_PATHNAME', 'pg_file_write'
LANGUAGE C VOLATILE STRICT;
CREATE OR REPLACE FUNCTION pg_catalog.pg_file_rename(text, text, text)
CREATE FUNCTION pg_catalog.pg_file_rename(text, text, text)
RETURNS bool
AS 'MODULE_PATHNAME', 'pg_file_rename'
LANGUAGE C VOLATILE;
CREATE OR REPLACE FUNCTION pg_catalog.pg_file_rename(text, text)
CREATE FUNCTION pg_catalog.pg_file_rename(text, text)
RETURNS bool
AS 'SELECT pg_catalog.pg_file_rename($1, $2, NULL::pg_catalog.text);'
LANGUAGE SQL VOLATILE STRICT;
CREATE OR REPLACE FUNCTION pg_catalog.pg_file_unlink(text)
CREATE FUNCTION pg_catalog.pg_file_unlink(text)
RETURNS bool
AS 'MODULE_PATHNAME', 'pg_file_unlink'
LANGUAGE C VOLATILE STRICT;
CREATE OR REPLACE FUNCTION pg_catalog.pg_logdir_ls()
CREATE FUNCTION pg_catalog.pg_logdir_ls()
RETURNS setof record
AS 'MODULE_PATHNAME', 'pg_logdir_ls'
LANGUAGE C VOLATILE STRICT;
@ -34,17 +34,17 @@ LANGUAGE C VOLATILE STRICT;
/* Renaming of existing backend functions for pgAdmin compatibility */
CREATE OR REPLACE FUNCTION pg_catalog.pg_file_read(text, bigint, bigint)
CREATE FUNCTION pg_catalog.pg_file_read(text, bigint, bigint)
RETURNS text
AS 'pg_read_file'
LANGUAGE INTERNAL VOLATILE STRICT;
CREATE OR REPLACE FUNCTION pg_catalog.pg_file_length(text)
CREATE FUNCTION pg_catalog.pg_file_length(text)
RETURNS bigint
AS 'SELECT size FROM pg_catalog.pg_stat_file($1)'
LANGUAGE SQL VOLATILE STRICT;
CREATE OR REPLACE FUNCTION pg_catalog.pg_logfile_rotate()
CREATE FUNCTION pg_catalog.pg_logfile_rotate()
RETURNS int4
AS 'pg_rotate_logfile'
LANGUAGE INTERNAL VOLATILE STRICT;