+
+
int
Cause server processes to reload their configuration files
+ |
+
+ pg_rotate_logfile()
+
+ int
+ Rotate server's logfile
+
- These functions return 1 if successful, 0 if not successful.
- The process ID (pid) of an active backend can be found
- from the procpid column in the
- pg_stat_activity view, or by listing the postgres
- processes on the server with
ps>.
+ Each of these functions returns 1 if successful, 0 if not successful.
+
+
+ pg_cancel_backend> sends a Query Cancel (SIGINT) signal
+ to a backend process identified by process ID (pid).
+ The process ID of an active backend can be found from the
+ procpid column in the
+ pg_stat_activity view, or by listing the
+ postgres processes on the server with
+
pg_reload_conf> sends a SIGHUP signal to the
postmaster, causing reload of the configuration files
in all server processes.
+ pg_rotate_logfile> signals the logfile manager to switch
+ to a new output file immediately. This works only when
+ redirect_stderr> is used for logging, since otherwise there
+ is no logfile manager subprocess.
+
+
- |
-
-
pg_file_length(filename> text>)
-
-
-
- int8
- Return the file length
-
|
pg_ls_dir(dirname> text>)
-
-
setof text
List the contents of a directory
pg_stat_file(filename> text>)
record
- Return information about the file
+ Return information about a file
+
+
+ pg_ls_dir()> returns all the names in the specified
+ directory, except the special entries .>> and
+ ..>>.
+
+
- pg_read_file()> returns part of a textfile, starting
- at the given offset, returning at most length bytes (less if the
- end of file is reached first). If offset is negative,
- it is relative to the end of the file.
+ pg_read_file()> returns part of a text file, starting
+ at the given
offset>, returning at most length>
+ bytes (less if the end of file is reached first). If
offset>
+ is negative, it is relative to the end of the file.
- pg_stat_file()> returns a record containing the
+ pg_stat_file()> returns a record containing the file
length, last accessed timestamp, last modified timestamp,
- creation timestamp, and a flag indicating if it is a directory.
- Use it like this:
+ creation timestamp, and a boolean indicating if it is a directory.
+ Typical usages include:
-SELECT *
-FROM pg_stat_file('filename')
- AS s(length int8, atime timestamptz, mtime timestamptz,
- ctime timestamptz, isdir bool);
+SELECT * FROM pg_stat_file('filename');
+SELECT (pg_stat_file('filename')).mtime;
- The function shown in
- linkend="functions-admin-logfile"> forces the server
- logfile to be rotated. This works only when redirect_stderr>
- is used for logging. Use of this function is restricted
- to superusers.
-
-
-
-
Server Logfile Functions
-
-
- Name Return Type Description
-
-
-
-
- |
-
- pg_rotate_logfile()
-
-
-
- int
- Rotate server's logfile
-
-
-
-
-
*
* Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.18 2005/07/31 17:19:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.19 2005/08/13 19:02:33 tgl Exp $
*/
CREATE VIEW pg_roles AS
pg_stat_get_db_blocks_hit(D.oid) AS blks_read,
pg_stat_get_db_blocks_hit(D.oid) AS blks_hit
FROM pg_database D;
+
+--
+-- Fix up built-in functions that make use of OUT parameters.
+-- We can't currently fill these values in during bootstrap, because
+-- array_in doesn't work in bootstrap mode. Eventually that should be
+-- fixed, but for now the path of least resistance is to patch their
+-- pg_proc entries later during initdb.
+--
+
+UPDATE pg_proc SET
+ proallargtypes = ARRAY['text'::regtype,
+ 'int8',
+ 'timestamptz',
+ 'timestamptz',
+ 'timestamptz',
+ 'bool'],
+ proargmodes = ARRAY['i'::"char", 'o', 'o', 'o', 'o', 'o'],
+ proargnames = ARRAY['filename'::text,
+ 'length', 'atime', 'mtime', 'ctime','isdir']
+WHERE oid = 'pg_stat_file(text)'::regprocedure;
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/genfile.c,v 1.3 2005/08/12 21:07:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/genfile.c,v 1.4 2005/08/13 19:02:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
(errcode_for_file_access(),
errmsg("could not stat file \"%s\": %m", filename)));
+ /*
+ * This record type had better match the output parameters declared
+ * for me in pg_proc.h (actually, in system_views.sql at the moment).
+ */
tupdesc = CreateTemplateTupleDesc(5, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1,
"length", INT8OID, -1, 0);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.297 2005/08/12 18:23:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.298 2005/08/13 19:02:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200508121
+#define CATALOG_VERSION_NO 200508131
#endif
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.382 2005/08/12 18:23:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.383 2005/08/13 19:02:34 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
DATA(insert OID = 2621 ( pg_reload_conf PGNSP PGUID 12 f f t f v 0 23 "" _null_ _null_ _null_ pg_reload_conf - _null_ ));
DESCR("Reload configuration files");
-
DATA(insert OID = 2622 ( pg_rotate_logfile PGNSP PGUID 12 f f t f v 0 23 "" _null_ _null_ _null_ pg_rotate_logfile - _null_ ));
DESCR("Rotate log file");
-
DATA(insert OID = 2623 ( pg_stat_file PGNSP PGUID 12 f f t f v 1 2249 "25" _null_ _null_ _null_ pg_stat_file - _null_ ));
DESCR("Return file information");
-DATA(insert OID = 2624 ( pg_file_length PGNSP PGUID 14 f f t f v 1 20 "25" _null_ _null_ _null_ "SELECT len FROM pg_stat_file($1) AS s(len int8, a timestamptz, m timestamptz, c timestamptz, i bool)" - _null_ ));
-DESCR("Return file length");
-DATA(insert OID = 2625 ( pg_read_file PGNSP PGUID 12 f f t f v 3 25 "25 20 20" _null_ _null_ _null_ pg_read_file - _null_ ));
+DATA(insert OID = 2624 ( pg_read_file PGNSP PGUID 12 f f t f v 3 25 "25 20 20" _null_ _null_ _null_ pg_read_file - _null_ ));
DESCR("Read text from a file");
-DATA(insert OID = 2626 ( pg_ls_dir PGNSP PGUID 12 f f t t v 1 25 "25" _null_ _null_ _null_ pg_ls_dir - _null_ ));
+DATA(insert OID = 2625 ( pg_ls_dir PGNSP PGUID 12 f f t t v 1 25 "25" _null_ _null_ _null_ pg_ls_dir - _null_ ));
DESCR("List all files in a directory");