Skip to content

Commit ad7b358

Browse files
author
Maksim Milyutin
committed
Add contrib sources
0 parents  commit ad7b358

12 files changed

+2129
-0
lines changed

Makefile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# contrib/pg_query_state/Makefile
2+
3+
MODULE_big = pg_query_state
4+
OBJS = pg_query_state.o signal_handler.o $(WIN32RES)
5+
EXTENSION = pg_query_state
6+
EXTVERSION = 1.0
7+
DATA = $(EXTENSION)--$(EXTVERSION).sql
8+
PGFILEDESC = "pg_query_state - facility to track progress of plan execution"
9+
10+
EXTRA_CLEAN = ./isolation_output
11+
12+
ifdef USE_PGXS
13+
PG_CONFIG = pg_config
14+
PGXS := $(shell $(PG_CONFIG) --pgxs)
15+
include $(PGXS)
16+
else
17+
subdir = contrib/pg_query_state
18+
top_builddir = ../..
19+
include $(top_builddir)/src/Makefile.global
20+
include $(top_srcdir)/contrib/contrib-global.mk
21+
endif
22+
23+
check: isolationcheck
24+
25+
ISOLATIONCHECKS=corner_cases
26+
27+
submake-isolation:
28+
$(MAKE) -C $(top_builddir)/src/test/isolation all
29+
30+
isolationcheck: | submake-isolation temp-install
31+
$(MKDIR_P) isolation_output
32+
$(pg_isolation_regress_check) \
33+
--temp-config $(top_srcdir)/contrib/pg_query_state/test.conf \
34+
--outputdir=isolation_output \
35+
$(ISOLATIONCHECKS)
36+
37+
isolationcheck-install-force: all | submake-isolation temp-install
38+
$(MKDIR_P) isolation_output
39+
$(pg_isolation_regress_installcheck) \
40+
--outputdir=isolation_output \
41+
$(ISOLATIONCHECKS)
42+
43+
.PHONY: isolationcheck isolationcheck-install-force check
44+
45+
temp-install: EXTRA_INSTALL=contrib/pg_query_state

README.md

Lines changed: 277 additions & 0 deletions
Large diffs are not rendered by default.

expected/corner_cases.out

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
Parsed test spec with 2 sessions
2+
3+
starting permutation: s1_pg_qs_1
4+
step s1_pg_qs_1: select pg_query_state(1);
5+
ERROR: backend with pid=1 not found
6+
7+
starting permutation: s1_pg_qs_2
8+
step s1_pg_qs_2: select pg_query_state(pg_backend_pid());
9+
ERROR: attempt to extract state of current process
10+
11+
starting permutation: s1_save_pid s2_pg_qs_counterpart
12+
step s1_save_pid: select save_own_pid(0);
13+
save_own_pid
14+
15+
16+
INFO: state of backend is idle
17+
step s2_pg_qs_counterpart: select pg_query_state(counterpart_pid(0));
18+
pg_query_state
19+
20+
21+
starting permutation: s1_save_pid s1_disable_pg_qs s2_pg_qs_counterpart
22+
step s1_save_pid: select save_own_pid(0);
23+
save_own_pid
24+
25+
26+
step s1_disable_pg_qs: set pg_query_state.enable to off;
27+
INFO: query execution statistics disabled
28+
step s2_pg_qs_counterpart: select pg_query_state(counterpart_pid(0));
29+
pg_query_state
30+
31+
32+
starting permutation: s1_set_bob s2_set_bob s1_save_pid s2_pg_qs_counterpart
33+
step s1_set_bob: set role bob;
34+
step s2_set_bob: set role bob;
35+
step s1_save_pid: select save_own_pid(0);
36+
save_own_pid
37+
38+
39+
INFO: state of backend is idle
40+
step s2_pg_qs_counterpart: select pg_query_state(counterpart_pid(0));
41+
pg_query_state
42+
43+
44+
starting permutation: s1_set_bob s2_set_su s1_save_pid s2_pg_qs_counterpart
45+
step s1_set_bob: set role bob;
46+
step s2_set_su: set role super;
47+
step s1_save_pid: select save_own_pid(0);
48+
save_own_pid
49+
50+
51+
INFO: state of backend is idle
52+
step s2_pg_qs_counterpart: select pg_query_state(counterpart_pid(0));
53+
pg_query_state
54+
55+
56+
starting permutation: s1_set_bob s2_set_alice s1_save_pid s2_pg_qs_counterpart
57+
step s1_set_bob: set role bob;
58+
step s2_set_alice: set role alice;
59+
step s1_save_pid: select save_own_pid(0);
60+
save_own_pid
61+
62+
63+
step s2_pg_qs_counterpart: select pg_query_state(counterpart_pid(0));
64+
ERROR: permission denied

pg_query_state--1.0.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
2+
\echo Use "CREATE EXTENSION pg_query_state" to load this file. \quit
3+
4+
CREATE FUNCTION pg_query_state(pid integer
5+
, verbose boolean = FALSE
6+
, costs boolean = FALSE
7+
, timing boolean = FALSE
8+
, buffers boolean = FALSE
9+
, triggers boolean = FALSE
10+
, format text = 'text')
11+
RETURNS TABLE (query_text text, plan text)
12+
AS 'MODULE_PATHNAME'
13+
LANGUAGE C STRICT VOLATILE;
14+
15+
CREATE FUNCTION executor_step(pid integer) RETURNS VOID
16+
AS 'MODULE_PATHNAME'
17+
LANGUAGE C VOLATILE;
18+
19+
CREATE FUNCTION executor_continue(pid integer) RETURNS VOID
20+
AS 'MODULE_PATHNAME'
21+
LANGUAGE C VOLATILE;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy