Skip to content

Commit 2a8c14d

Browse files
committed
updated postgres_info_pre10.sql
1 parent f071662 commit 2a8c14d

File tree

1 file changed

+69
-69
lines changed

1 file changed

+69
-69
lines changed

postgres_info_pre10.sql

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
-- version() returns a long human readable string, hence we split from others SELECTs eg.
3131
-- PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
3232
SELECT
33-
version(),
34-
current_setting('server_version') AS "server_version",
35-
current_setting('server_version_num') AS "server_version_num";
33+
version(),
34+
current_setting('server_version') AS "server_version",
35+
current_setting('server_version_num') AS "server_version_num";
3636

3737
-- ========================================================================== --
3838
-- S e r v e r D e t a i l s
@@ -42,18 +42,18 @@ SELECT
4242
--\pset title 'PostgreSQL Server Details'
4343

4444
SELECT
45-
pg_postmaster_start_time(),
46-
pg_conf_load_time(),
47-
current_setting('logging_collector') AS "logging_collector",
48-
current_setting('log_destination') AS "log_destination"
49-
-- not available in Postgres 9
50-
-- doesn't work because it still checks if pg_current_logfile() is valid and neither eval or execute seem to work around this
51-
-- CASE WHEN current_setting('server_version_num')::int > 100000 THEN pg_current_logfile() ELSE NULL END as pg_current_logfile
52-
--pg_current_logfile()
53-
-- current_setting('log_directory') AS "log_directory", -- log
54-
-- current_setting('log_filename') AS "log_filename", -- postgresql-%Y-%m-%d_%H%M%S.log
55-
-- not available on Postgres 10
56-
--pg_jit_available()
45+
pg_postmaster_start_time(),
46+
pg_conf_load_time(),
47+
current_setting('logging_collector') AS "logging_collector",
48+
current_setting('log_destination') AS "log_destination"
49+
-- not available in Postgres 9
50+
-- doesn't work because it still checks if pg_current_logfile() is valid and neither eval or execute seem to work around this
51+
-- CASE WHEN current_setting('server_version_num')::int > 100000 THEN pg_current_logfile() ELSE NULL END as pg_current_logfile
52+
--pg_current_logfile()
53+
-- current_setting('log_directory') AS "log_directory", -- log
54+
-- current_setting('log_filename') AS "log_filename", -- postgresql-%Y-%m-%d_%H%M%S.log
55+
-- not available on Postgres 10
56+
--pg_jit_available()
5757
;
5858

5959
-- SELECT pg_reload_conf(), pg_rotate_logfile();
@@ -85,19 +85,19 @@ SELECT
8585
--\pset title 'Config Files'
8686

8787
SELECT
88-
current_setting('config_file') AS "config_file",
89-
current_setting('hba_file') AS "hba_file",
90-
current_setting('ident_file') AS "ident_file";
88+
current_setting('config_file') AS "config_file",
89+
current_setting('hba_file') AS "hba_file",
90+
current_setting('ident_file') AS "ident_file";
9191

9292
\echo
9393
--\pset title 'PostgreSQL Data Directory & Unix Sockets'
9494

9595
SELECT
96-
current_setting('data_directory') AS "data_directory",
97-
-- not available on PostgreSQL <= 9.2
98-
--current_setting('unix_socket_directories') AS "unix_socket_directories",
99-
current_setting('unix_socket_permissions') AS "unix_socket_permissions",
100-
current_setting('unix_socket_group') AS "unix_socket_group";
96+
current_setting('data_directory') AS "data_directory",
97+
-- not available on PostgreSQL <= 9.2
98+
--current_setting('unix_socket_directories') AS "unix_socket_directories",
99+
current_setting('unix_socket_permissions') AS "unix_socket_permissions",
100+
current_setting('unix_socket_group') AS "unix_socket_group";
101101

102102
-- ========================================================================== --
103103
-- B u f f e r s & C o n n e c t i o n s
@@ -107,13 +107,13 @@ SELECT
107107
--\pset title 'Buffers & Connections'
108108

109109
SELECT
110-
current_setting('shared_buffers') AS "shared_buffers",
111-
current_setting('work_mem') AS "work_mem",
112-
current_setting('max_connections') AS "max_connections",
113-
current_setting('max_files_per_process') AS "max_files_per_process", -- should be less than ulimit nofiles to avoid “Too many open files” failures
114-
current_setting('track_activities') AS "track_activities", -- for pg_stat / pg_statio family of system views that are used in many other adjacent scripts
115-
current_setting('track_counts') AS "track_counts", -- needed for the autovacuum daemon
116-
current_setting('password_encryption') AS "password_encryption";
110+
current_setting('shared_buffers') AS "shared_buffers",
111+
current_setting('work_mem') AS "work_mem",
112+
current_setting('max_connections') AS "max_connections",
113+
current_setting('max_files_per_process') AS "max_files_per_process", -- should be less than ulimit nofiles to avoid “Too many open files” failures
114+
current_setting('track_activities') AS "track_activities", -- for pg_stat / pg_statio family of system views that are used in many other adjacent scripts
115+
current_setting('track_counts') AS "track_counts", -- needed for the autovacuum daemon
116+
current_setting('password_encryption') AS "password_encryption";
117117

118118

119119
-- ========================================================================== --
@@ -125,12 +125,12 @@ SELECT
125125

126126
-- in SQL the following have special syntax and should be called without parens: current_catalog, current_role, current_schema, current_user, session_user
127127
SELECT
128-
current_user, -- aka user, current_role - this is the effective user for permission checking
129-
session_user, -- connection user before superuser SET SESSION AUTHORIZATION
130-
current_schema,
131-
current_catalog, -- SQL standard, same as current_database()
132-
pg_backend_pid(),
133-
current_query();
128+
current_user, -- aka user, current_role - this is the effective user for permission checking
129+
session_user, -- connection user before superuser SET SESSION AUTHORIZATION
130+
current_schema,
131+
current_catalog, -- SQL standard, same as current_database()
132+
pg_backend_pid(),
133+
current_query();
134134

135135
\echo
136136
--\pset title 'Schema search list'
@@ -143,19 +143,19 @@ SELECT current_schemas(true) AS "current_schemas(true) - auto-searched schemas";
143143
-- ========================================================================== --
144144

145145
--SELECT
146-
-- not available on PostgreSQL <= 9.2
147-
--pg_is_in_backup(),
148-
-- not available on PostgreSQL 8.4
149-
--pg_is_in_recovery(),
150-
-- not available on PostgreSQL <= 9.2
151-
-- pg_backup_start_time(),
146+
-- not available on PostgreSQL <= 9.2
147+
--pg_is_in_backup(),
148+
-- not available on PostgreSQL 8.4
149+
--pg_is_in_recovery(),
150+
-- not available on PostgreSQL <= 9.2
151+
-- pg_backup_start_time(),
152152
-- 'see postgres_recovery.sql for more info' AS "info";
153-
-- use postgres_recovery.sql instead of having a big blank table distracting us here
154-
-- the following recovery control functions can only be executed during recovery - to get just the above use postgres_funcs.sql
155-
--( CASE WHEN pg_is_in_recovery() THEN pg_is_wal_replay_paused() END) AS "pg_is_wal_replay_paused()",
156-
--( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_receive_lsn() END) AS "pg_last_wal_receive_lsn()",
157-
--( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_replay_lsn() END) AS "pg_last_wal_replay_lsn()",
158-
--( CASE WHEN pg_is_in_recovery() THEN pg_last_xact_replay_timestamp() END) AS "pg_last_xact_replay_timestamp()"
153+
-- use postgres_recovery.sql instead of having a big blank table distracting us here
154+
-- the following recovery control functions can only be executed during recovery - to get just the above use postgres_funcs.sql
155+
--( CASE WHEN pg_is_in_recovery() THEN pg_is_wal_replay_paused() END) AS "pg_is_wal_replay_paused()",
156+
--( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_receive_lsn() END) AS "pg_last_wal_receive_lsn()",
157+
--( CASE WHEN pg_is_in_recovery() THEN pg_last_wal_replay_lsn() END) AS "pg_last_wal_replay_lsn()",
158+
--( CASE WHEN pg_is_in_recovery() THEN pg_last_xact_replay_timestamp() END) AS "pg_last_xact_replay_timestamp()"
159159

160160
--SELECT
161161
-- pg_ls_logdir(),
@@ -175,10 +175,10 @@ SELECT current_schemas(true) AS "current_schemas(true) - auto-searched schemas";
175175
--\pset title 'Networking'
176176

177177
SELECT
178-
inet_client_addr(),
179-
inet_client_addr(),
180-
inet_server_addr(),
181-
inet_server_port();
178+
inet_client_addr(),
179+
inet_client_addr(),
180+
inet_server_addr(),
181+
inet_server_port();
182182

183183
-- causes 0 rows when mixed with other select funcs
184184
--SELECT pg_listening_channels();
@@ -195,23 +195,23 @@ SELECT
195195
--\pset title 'Date & Time'
196196

197197
SELECT
198-
-- current timestamps even inside transactions/functions
199-
now(),
200-
timeofday(), -- human string timestamp with timezone
201-
202-
-- at start of current transaction for consistency, includes +offset timezone
203-
current_timestamp(2) AS "current_timestamp(2)", -- secs precision of 2 decimal places, includes +offset timezone
204-
current_date,
205-
current_time(1) AS "current_time(1)", -- includes +offset timezone
206-
localtime,
207-
localtimestamp(1) AS "localtimestamp(1)",
208-
209-
-- provide current timestamps even inside transactions/functions
210-
-- now()
211-
-- timeofday(), -- human string timestamp with timezone
212-
clock_timestamp(), -- current date + time (changes throughout function)
213-
statement_timestamp(),
214-
transaction_timestamp() -- same as CURRENT_TIMESTAMP
198+
-- current timestamps even inside transactions/functions
199+
now(),
200+
timeofday(), -- human string timestamp with timezone
201+
202+
-- at start of current transaction for consistency, includes +offset timezone
203+
current_timestamp(2) AS "current_timestamp(2)", -- secs precision of 2 decimal places, includes +offset timezone
204+
current_date,
205+
current_time(1) AS "current_time(1)", -- includes +offset timezone
206+
localtime,
207+
localtimestamp(1) AS "localtimestamp(1)",
208+
209+
-- provide current timestamps even inside transactions/functions
210+
-- now()
211+
-- timeofday(), -- human string timestamp with timezone
212+
clock_timestamp(), -- current date + time (changes throughout function)
213+
statement_timestamp(),
214+
transaction_timestamp() -- same as CURRENT_TIMESTAMP
215215
;
216216

217217
--\pset title

0 commit comments

Comments
 (0)