public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dong Wook Lee <[email protected]>
To: [email protected]
Subject: Re: Add pg_freespacemap extension sql test
Date: Tue, 8 Mar 2022 23:43:47 +0900
Message-ID: <CAAcByaKWYktP-DdZMZ-NSKiuXK5XtGKTKM5P8ae1EfNF2EKguA@mail.gmail.com> (raw)
In-Reply-To: <CAAcByaJ5KW3bd7fJr=jPEyK8M_UzXJFHHBVuOcBe+JHD8txRyQ@mail.gmail.com>
References: <CAAcByaJ5KW3bd7fJr=jPEyK8M_UzXJFHHBVuOcBe+JHD8txRyQ@mail.gmail.com>
I'm sorry for attaching the wrong patch file.
2022년 3월 8일 (화) 오후 11:39, Dong Wook Lee <[email protected]>님이 작성:
> Hi,
> I just added some tests for the pg_freespacemap extension because the test
> coverage was 0 percent.
> But I don't know if I did it correctly.
>
> ---
> Regards
> Lee Dong Wook
>
Attachments:
[application/octet-stream] 0001_add_test_pg_fsm.patch (2.0K, ../CAAcByaKWYktP-DdZMZ-NSKiuXK5XtGKTKM5P8ae1EfNF2EKguA@mail.gmail.com/3-0001_add_test_pg_fsm.patch)
download | inline diff:
diff --git a/contrib/pg_freespacemap/Makefile b/contrib/pg_freespacemap/Makefile
index da40b80c7c..2d525a1284 100644
--- a/contrib/pg_freespacemap/Makefile
+++ b/contrib/pg_freespacemap/Makefile
@@ -10,6 +10,8 @@ DATA = pg_freespacemap--1.1.sql pg_freespacemap--1.1--1.2.sql \
pg_freespacemap--1.0--1.1.sql
PGFILEDESC = "pg_freespacemap - monitoring of free space map"
+REGRESS = pg_freespacemap
+
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
diff --git a/contrib/pg_freespacemap/expected/pg_freespacemap.out b/contrib/pg_freespacemap/expected/pg_freespacemap.out
new file mode 100644
index 0000000000..fc975b9050
--- /dev/null
+++ b/contrib/pg_freespacemap/expected/pg_freespacemap.out
@@ -0,0 +1,36 @@
+CREATE EXTENSION pg_freespacemap;
+CREATE TABLE t1(c1 int);
+INSERT INTO t1 VALUES (generate_series(1, 1000));
+VACUUM t1;
+SELECT * FROM pg_freespace('t1');
+ blkno | avail
+-------+-------
+ 0 | 0
+ 1 | 0
+ 2 | 0
+ 3 | 0
+ 4 | 4704
+(5 rows)
+
+DELETE FROM t1 WHERE c1 <= 10;
+VACUUM t1;
+SELECT * FROM pg_freespace('t1');
+ blkno | avail
+-------+-------
+ 0 | 320
+ 1 | 0
+ 2 | 0
+ 3 | 0
+ 4 | 4704
+(5 rows)
+
+SELECT * FROM pg_freespace('t1', 0);
+ pg_freespace
+--------------
+ 320
+(1 row)
+
+SELECT * FROM pg_freespace('t1', -1);
+ERROR: invalid block number
+SELECT * FROM pg_freespace('t1', 4294967295);
+ERROR: invalid block number
diff --git a/contrib/pg_freespacemap/sql/pg_freespacemap.sql b/contrib/pg_freespacemap/sql/pg_freespacemap.sql
new file mode 100644
index 0000000000..cc175322cd
--- /dev/null
+++ b/contrib/pg_freespacemap/sql/pg_freespacemap.sql
@@ -0,0 +1,17 @@
+CREATE EXTENSION pg_freespacemap;
+
+CREATE TABLE t1(c1 int);
+
+INSERT INTO t1 VALUES (generate_series(1, 1000));
+VACUUM t1;
+
+SELECT * FROM pg_freespace('t1');
+
+DELETE FROM t1 WHERE c1 <= 10;
+VACUUM t1;
+
+SELECT * FROM pg_freespace('t1');
+SELECT * FROM pg_freespace('t1', 0);
+
+SELECT * FROM pg_freespace('t1', -1);
+SELECT * FROM pg_freespace('t1', 4294967295);
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Add pg_freespacemap extension sql test
In-Reply-To: <CAAcByaKWYktP-DdZMZ-NSKiuXK5XtGKTKM5P8ae1EfNF2EKguA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox