1/* contrib/adminpack/adminpack--1.0.sql */ 2 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 6/* *********************************************** 7 * Administrative functions for PostgreSQL 8 * *********************************************** */ 9 10/* generic file access functions */ 11 12CREATE FUNCTION pg_catalog.pg_file_write(text, text, bool) 13RETURNS bigint 14AS 'MODULE_PATHNAME', 'pg_file_write' 15LANGUAGE C VOLATILE STRICT; 16 17CREATE FUNCTION pg_catalog.pg_file_rename(text, text, text) 18RETURNS bool 19AS 'MODULE_PATHNAME', 'pg_file_rename' 20LANGUAGE C VOLATILE; 21 22CREATE FUNCTION pg_catalog.pg_file_rename(text, text) 23RETURNS bool 24AS 'SELECT pg_catalog.pg_file_rename($1, $2, NULL::pg_catalog.text);' 25LANGUAGE SQL VOLATILE STRICT; 26 27CREATE FUNCTION pg_catalog.pg_file_unlink(text) 28RETURNS bool 29AS 'MODULE_PATHNAME', 'pg_file_unlink' 30LANGUAGE C VOLATILE STRICT; 31 32CREATE FUNCTION pg_catalog.pg_logdir_ls() 33RETURNS setof record 34AS 'MODULE_PATHNAME', 'pg_logdir_ls' 35LANGUAGE C VOLATILE STRICT; 36 37 38/* Renaming of existing backend functions for pgAdmin compatibility */ 39 40CREATE FUNCTION pg_catalog.pg_file_read(text, bigint, bigint) 41RETURNS text 42AS 'pg_read_file' 43LANGUAGE INTERNAL VOLATILE STRICT; 44 45CREATE FUNCTION pg_catalog.pg_file_length(text) 46RETURNS bigint 47AS 'SELECT size FROM pg_catalog.pg_stat_file($1)' 48LANGUAGE SQL VOLATILE STRICT; 49 50CREATE FUNCTION pg_catalog.pg_logfile_rotate() 51RETURNS int4 52AS 'pg_rotate_logfile' 53LANGUAGE INTERNAL VOLATILE STRICT; 54