Skip to content

Commit

Permalink
Fix new function declarations
Browse files Browse the repository at this point in the history
Many of the newest batch of function declarations were incorrectly
written as "CREATE OR REPLACE FUNCTION" rather than "CREATE FUNCTION",
which is not per official project guidance for security reasons as well
as to avoid inadvertantly overwriting pre-existing same-named functions.
Fix that. While at it, some <tab> charachters had crep into the SQL
files -- replace those with spaces.
  • Loading branch information
jconway committed Feb 3, 2022
1 parent f995cc8 commit 8a95bb8
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 181 deletions.
10 changes: 5 additions & 5 deletions pg_proctab--0.0.10-compat.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* pg_top as a remote target.
*/

CREATE OR REPLACE FUNCTION pg_cputime(
CREATE FUNCTION pg_cputime(
OUT "user" BIGINT,
OUT nice BIGINT,
OUT system BIGINT,
Expand All @@ -22,7 +22,7 @@ AS $$
FROM proc_cputime()
$$ LANGUAGE sql;

CREATE OR REPLACE FUNCTION pg_loadavg(
CREATE FUNCTION pg_loadavg(
OUT load1 FLOAT,
OUT load5 FLOAT,
OUT load15 FLOAT,
Expand All @@ -38,7 +38,7 @@ $$ LANGUAGE sql;
* Compatibility note: in the original implementation memshared
* is always equal to zero. Here we use the value from Shmem instead.
*/
CREATE OR REPLACE FUNCTION pg_memusage(
CREATE FUNCTION pg_memusage(
OUT memused BIGINT,
OUT memfree BIGINT,
OUT memshared BIGINT,
Expand All @@ -65,7 +65,7 @@ AS $$
(SELECT val FROM m WHERE key = 'SwapCached') / 1024 as swapcached
$$ LANGUAGE sql;

CREATE OR REPLACE FUNCTION pg_proctab(
CREATE FUNCTION pg_proctab(
OUT pid integer,
OUT comm character varying,
OUT fullcomm character varying,
Expand Down Expand Up @@ -155,7 +155,7 @@ AS $$
ON c.pid = i.pid
$$ LANGUAGE sql;

CREATE OR REPLACE FUNCTION pg_diskusage (
CREATE FUNCTION pg_diskusage (
OUT major smallint,
OUT minor smallint,
OUT devname text,
Expand Down
176 changes: 88 additions & 88 deletions pgnodemx--1.2--1.3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,128 +3,128 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pgnodemx" to load this file. \quit

CREATE OR REPLACE FUNCTION proc_pid_io(
OUT pid INTEGER,
OUT rchar NUMERIC,
OUT wchar NUMERIC,
OUT syscr NUMERIC,
OUT syscw NUMERIC,
OUT reads NUMERIC,
OUT writes NUMERIC,
OUT cwrites NUMERIC)
CREATE FUNCTION proc_pid_io(
OUT pid INTEGER,
OUT rchar NUMERIC,
OUT wchar NUMERIC,
OUT syscr NUMERIC,
OUT syscw NUMERIC,
OUT reads NUMERIC,
OUT writes NUMERIC,
OUT cwrites NUMERIC)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_pid_io'
LANGUAGE C IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION proc_pid_cmdline(
OUT pid INTEGER,
OUT fullcomm TEXT,
OUT uid INTEGER,
OUT username TEXT
CREATE FUNCTION proc_pid_cmdline(
OUT pid INTEGER,
OUT fullcomm TEXT,
OUT uid INTEGER,
OUT username TEXT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_pid_cmdline'
LANGUAGE C IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION proc_pid_stat(
OUT pid INTEGER,
OUT comm TEXT,
OUT state TEXT,
OUT ppid INTEGER,
OUT pgrp INTEGER,
OUT session INTEGER,
OUT tty_nr INTEGER,
OUT tpgid INTEGER,
OUT flags BIGINT,
OUT minflt NUMERIC,
OUT cminflt NUMERIC,
OUT majflt NUMERIC,
OUT cmajflt NUMERIC,
OUT utime NUMERIC,
OUT stime NUMERIC,
OUT cutime BIGINT,
OUT cstime BIGINT,
OUT priority BIGINT,
OUT nice BIGINT,
OUT num_threads BIGINT,
OUT itrealvalue BIGINT,
OUT starttime NUMERIC,
OUT vsize NUMERIC,
OUT rss BIGINT,
OUT rsslim NUMERIC,
OUT startcode NUMERIC,
OUT endcode NUMERIC,
OUT startstack NUMERIC,
OUT kstkesp NUMERIC,
OUT kstkeip NUMERIC,
OUT signal NUMERIC,
OUT blocked NUMERIC,
OUT sigignore NUMERIC,
OUT sigcatch NUMERIC,
OUT wchan NUMERIC,
OUT nswap NUMERIC,
OUT cnswap NUMERIC,
OUT exit_signal INTEGER,
OUT processor INTEGER,
OUT rt_priority BIGINT,
OUT policy BIGINT,
OUT delayacct_blkio_ticks NUMERIC,
OUT guest_time NUMERIC,
OUT cguest_time BIGINT,
OUT start_data NUMERIC,
OUT end_data NUMERIC,
OUT start_brk NUMERIC,
OUT arg_start NUMERIC,
OUT arg_end NUMERIC,
OUT env_start NUMERIC,
OUT env_end NUMERIC,
OUT exit_code INTEGER)
CREATE FUNCTION proc_pid_stat(
OUT pid INTEGER,
OUT comm TEXT,
OUT state TEXT,
OUT ppid INTEGER,
OUT pgrp INTEGER,
OUT session INTEGER,
OUT tty_nr INTEGER,
OUT tpgid INTEGER,
OUT flags BIGINT,
OUT minflt NUMERIC,
OUT cminflt NUMERIC,
OUT majflt NUMERIC,
OUT cmajflt NUMERIC,
OUT utime NUMERIC,
OUT stime NUMERIC,
OUT cutime BIGINT,
OUT cstime BIGINT,
OUT priority BIGINT,
OUT nice BIGINT,
OUT num_threads BIGINT,
OUT itrealvalue BIGINT,
OUT starttime NUMERIC,
OUT vsize NUMERIC,
OUT rss BIGINT,
OUT rsslim NUMERIC,
OUT startcode NUMERIC,
OUT endcode NUMERIC,
OUT startstack NUMERIC,
OUT kstkesp NUMERIC,
OUT kstkeip NUMERIC,
OUT signal NUMERIC,
OUT blocked NUMERIC,
OUT sigignore NUMERIC,
OUT sigcatch NUMERIC,
OUT wchan NUMERIC,
OUT nswap NUMERIC,
OUT cnswap NUMERIC,
OUT exit_signal INTEGER,
OUT processor INTEGER,
OUT rt_priority BIGINT,
OUT policy BIGINT,
OUT delayacct_blkio_ticks NUMERIC,
OUT guest_time NUMERIC,
OUT cguest_time BIGINT,
OUT start_data NUMERIC,
OUT end_data NUMERIC,
OUT start_brk NUMERIC,
OUT arg_start NUMERIC,
OUT arg_end NUMERIC,
OUT env_start NUMERIC,
OUT env_end NUMERIC,
OUT exit_code INTEGER)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_pid_stat'
LANGUAGE C IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION kpages_to_bytes(NUMERIC)
CREATE FUNCTION kpages_to_bytes(NUMERIC)
RETURNS NUMERIC
AS 'MODULE_PATHNAME', 'pgnodemx_pages_to_bytes'
LANGUAGE C IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION proc_cputime(
OUT "user" BIGINT,
OUT nice BIGINT,
OUT system BIGINT,
OUT idle BIGINT,
OUT iowait BIGINT)
CREATE FUNCTION proc_cputime(
OUT "user" BIGINT,
OUT nice BIGINT,
OUT system BIGINT,
OUT idle BIGINT,
OUT iowait BIGINT)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_cputime'
LANGUAGE C IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION proc_loadavg(
OUT load1 FLOAT,
OUT load5 FLOAT,
OUT load15 FLOAT,
OUT last_pid INTEGER)
CREATE FUNCTION proc_loadavg(
OUT load1 FLOAT,
OUT load5 FLOAT,
OUT load15 FLOAT,
OUT last_pid INTEGER)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_loadavg'
LANGUAGE C IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION exec_path()
CREATE FUNCTION exec_path()
RETURNS TEXT
AS 'MODULE_PATHNAME', 'pgnodemx_exec_path'
LANGUAGE C IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION stat_file(
IN filename TEXT,
OUT uid NUMERIC,
OUT username TEXT,
OUT gid NUMERIC,
OUT groupname TEXT,
OUT filemode TEXT
CREATE FUNCTION stat_file(
IN filename TEXT,
OUT uid NUMERIC,
OUT username TEXT,
OUT gid NUMERIC,
OUT groupname TEXT,
OUT filemode TEXT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_stat_file'
LANGUAGE C IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION openssl_version()
CREATE FUNCTION openssl_version()
RETURNS TEXT
AS 'MODULE_PATHNAME', 'pgnodemx_openssl_version'
LANGUAGE C IMMUTABLE STRICT;
Expand Down
Loading

0 comments on commit 8a95bb8

Please sign in to comment.