Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9be244d

Browse files
committed
Add minimal set of regression tests for pg_stat_statements.
While the set of covered functionality is fairly small, the added testsstill are useful to get some basic buildfarm testing ofpg_stat_statements itself, but also to exercise the lwlock tranch codeon the buildfarm.Author: Amit Kapila, slightly editorialized by meReviewed-By: Ashutosh Sharma, Andres FreundDiscussion: <CAA4eK1JOjkdXYtHxh=2aDK4VgDtN-LNGKY_YqX0N=YEvuzQVWg@mail.gmail.com>
1 parent1c14755 commit9be244d

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

‎contrib/pg_stat_statements/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ PGFILEDESC = "pg_stat_statements - execution statistics of SQL statements"
1111

1212
LDFLAGS_SL +=$(filter -lm,$(LIBS))
1313

14+
REGRESS_OPTS = --temp-config$(top_srcdir)/contrib/pg_stat_statements/pg_stat_statements.conf
15+
REGRESS = pg_stat_statements
16+
1417
ifdefUSE_PGXS
1518
PG_CONFIG = pg_config
1619
PGXS :=$(shell$(PG_CONFIG) --pgxs)
@@ -21,3 +24,7 @@ top_builddir = ../..
2124
include$(top_builddir)/src/Makefile.global
2225
include$(top_srcdir)/contrib/contrib-global.mk
2326
endif
27+
28+
# Disabled because these tests require "shared_preload_libraries=pg_stat_statements",
29+
# which typical installcheck users do not have (e.g. buildfarm clients).
30+
installcheck: REGRESS=
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CREATE EXTENSION pg_stat_statements;
2+
CREATE TABLE test (a int, b char(20));
3+
-- test the basic functionality of pg_stat_statements
4+
SELECT pg_stat_statements_reset();
5+
pg_stat_statements_reset
6+
--------------------------
7+
8+
(1 row)
9+
10+
INSERT INTO test VALUES(generate_series(1, 10), 'aaa');
11+
UPDATE test SET b = 'bbb' WHERE a > 5;
12+
SELECT query, calls, rows from pg_stat_statements ORDER BY rows;
13+
query | calls | rows
14+
----------------------------------------------------+-------+------
15+
SELECT pg_stat_statements_reset(); | 1 | 1
16+
UPDATE test SET b = ? WHERE a > ?; | 1 | 5
17+
INSERT INTO test VALUES(generate_series(?, ?), ?); | 1 | 10
18+
(3 rows)
19+
20+
DROP TABLE test;
21+
DROP EXTENSION pg_stat_statements;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shared_preload_libraries = 'pg_stat_statements'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CREATE EXTENSION pg_stat_statements;
2+
3+
CREATETABLEtest (aint, bchar(20));
4+
5+
-- test the basic functionality of pg_stat_statements
6+
SELECT pg_stat_statements_reset();
7+
8+
INSERT INTO testVALUES(generate_series(1,10),'aaa');
9+
UPDATE testSET b='bbb'WHERE a>5;
10+
11+
SELECT query, calls, rowsfrom pg_stat_statementsORDER BY rows;
12+
13+
DROPTABLE test;
14+
15+
DROP EXTENSION pg_stat_statements;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp