Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pg_dbms_stats to support PostgreSQL 15 #10

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pg_dbms_stats/Makefile

DBMSSTATSVER = 14.0
PGVERS = 14
DBMSSTATSVER = 15.0
PGVERS = 15

MODULE_big = pg_dbms_stats
OBJS = pg_dbms_stats.o dump.o import.o
Expand Down Expand Up @@ -34,8 +34,6 @@ STARBALLS = $(STARBALL) $(foreach v,$(PGVERS),pg_dbms_stats$(v).tar.gz)
RPMS = $(foreach v,$(PGVERS),rpm$(v))

EXTRA_CLEAN = sql/ut_anyarray-*.sql expected/ut_anyarray-*.out \
sql/ut_imp_exp-*.sql expected/ut_imp_exp-*.out \
sql/ut_fdw_init.sql expected/ut_fdw_init.out \
export_stats.dmp ut-fdw.csv $(STARBALLS) RPMS/*/* \
*~

Expand Down
26 changes: 13 additions & 13 deletions SPECS/pg_dbms_stats.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPEC file for pg_dbms_stats14
# SPEC file for pg_dbms_stats15
# Copyright(c) 2012-2022, NIPPON TELEGRAPH AND TELEPHONE CORPORATION

%define _pgdir /usr/pgsql-14
%define _pgdir /usr/pgsql-15
%define _bindir %{_pgdir}/bin
%define _libdir %{_pgdir}/lib
%define _datadir %{_pgdir}/share
Expand All @@ -14,9 +14,9 @@
%endif

## Set general information for pg_dbms_stats.
Summary: Plan Stabilizer for PostgreSQL 14
Summary: Plan Stabilizer for PostgreSQL 15
Name: pg_dbms_stats
Version: 14.0
Version: 15.0
Release: 1%{?dist}
License: BSD
Group: Applications/Databases
Expand All @@ -39,25 +39,25 @@ pg_dbms_stats also provides following features:
- backup multiple generations of planner statistics to reuse plans afterwards
- import planner statistics from another system for tuning or testing.

Note that this package is available for only PostgreSQL 14.
Note that this package is available for only PostgreSQL 15.

%package llvmjit
Requires: postgresql14-server, postgresql14-llvmjit
Requires: pg_dbms_stats = 14.0
Summary: Just-in-time compilation support for pg_dbms_stats 14
Requires: postgresql15-server, postgresql15-llvmjit
Requires: pg_dbms_stats = 15.0
Summary: Just-in-time compilation support for pg_dbms_stats 15

%description llvmjit
Just-in-time compilation support for pg_dmbs_stats 14
Just-in-time compilation support for pg_dmbs_stats 15

## pre work for build pg_dbms_stats
%prep
PATH=/usr/pgsql-14/bin:$PATH
PATH=/usr/pgsql-15/bin:$PATH
if [ ! -d %{_rpmdir} ]; then mkdir -p %{_rpmdir}; fi
%setup -q

## Set variables for build environment
%build
PATH=/usr/pgsql-14/bin:$PATH
PATH=/usr/pgsql-15/bin:$PATH
make USE_PGXS=1 %{?_smp_mflags}

## Set variables for install
Expand All @@ -74,8 +74,8 @@ rm -rf %{buildroot}
%defattr(0644,root,root)
%{_datadir}/extension/pg_dbms_stats--%{version}.sql
%{_datadir}/extension/pg_dbms_stats.control
%{_docdir}/extension/export_effective_stats-14.sql.sample
%{_docdir}/extension/export_plain_stats-14.sql.sample
%{_docdir}/extension/export_effective_stats-15.sql.sample
%{_docdir}/extension/export_plain_stats-15.sql.sample

%files llvmjit
%{_bcdir}
Expand Down
2 changes: 1 addition & 1 deletion doc/objects-en.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pg_dbms_stats 14.0
# pg_dbms_stats 15.0

[pg_dms_stats](pg_dbms_stats-en.md) -> [Appendix A. Object List](objects-en.md)

Expand Down
2 changes: 1 addition & 1 deletion doc/objects-ja.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pg_dbms_stats 14.0
# pg_dbms_stats 15.0

[pg_dms_stats](pg_dbms_stats-ja.md) -> [Appendix A. オブジェクト一覧](objects-ja.md)

Expand Down
4 changes: 2 additions & 2 deletions doc/pg_dbms_stats-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

</div>

# pg_dbms_stats 14.0
# pg_dbms_stats 15.0
---

## NAME
Expand Down Expand Up @@ -456,7 +456,7 @@ You can inject values by the following three steps.
## ENVIRONMENT

PostgreSQL
14
15

OS
RHEL 7/8
Expand Down
4 changes: 2 additions & 2 deletions doc/pg_dbms_stats-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

</div>

# pg_dbms_stats 14.0
# pg_dbms_stats 15.0

## 名前

Expand Down Expand Up @@ -449,7 +449,7 @@ pg_dbms_statsの各機能は、前節で説明した独自の統計情報テー
## 動作環境

PostgreSQLバージョン
PostgreSQL 14
PostgreSQL 15

OS
RHEL 7/8
Expand Down
2 changes: 0 additions & 2 deletions expected/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
/ut_anyarray-*.out
/ut_imp_exp-*.out
/ut_fdw_init.out
28 changes: 14 additions & 14 deletions expected/ut-common.out
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ SELECT relname, curpages FROM dbms_stats.relation_stats_locked
public.st1 | 45
(1 row)

SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand All @@ -664,7 +664,7 @@ SELECT pg_stat_reset();
VACUUM ANALYZE;
UPDATE dbms_stats.relation_stats_locked SET curpages = 1000
WHERE relid = 'st1_exp'::regclass;
SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand Down Expand Up @@ -696,7 +696,7 @@ SELECT relname, curpages FROM dbms_stats.relation_stats_locked
public.st1 | 45
(1 row)

SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand Down Expand Up @@ -820,7 +820,7 @@ SELECT * FROM s0.droptest
1
(1 row)

SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand All @@ -839,7 +839,7 @@ SELECT pg_stat_reset();
(1 row)

ALTER TABLE s0.droptest RENAME TO test;
SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand Down Expand Up @@ -871,7 +871,7 @@ SELECT * FROM s0.test
1
(1 row)

SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand All @@ -894,7 +894,7 @@ SELECT * FROM s0.droptest
1
(1 row)

SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand All @@ -913,7 +913,7 @@ SELECT pg_stat_reset();
(1 row)

ALTER TABLE s0.droptest RENAME id TO test;
SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand Down Expand Up @@ -945,7 +945,7 @@ SELECT * FROM s0.droptest
1
(1 row)

SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand All @@ -968,7 +968,7 @@ SELECT * FROM s0.droptest
1
(1 row)

SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand All @@ -987,7 +987,7 @@ SELECT pg_stat_reset();
(1 row)

ANALYZE;
SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand Down Expand Up @@ -1042,7 +1042,7 @@ SELECT * FROM s0.droptest
4
(1 row)

SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand All @@ -1061,7 +1061,7 @@ SELECT pg_stat_reset();
(1 row)

VACUUM ANALYZE;
SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand Down Expand Up @@ -1093,7 +1093,7 @@ SELECT * FROM s0.droptest
4
(1 row)

SELECT pg_sleep(0.7);
SELECT pg_sleep(1.2);
pg_sleep
----------

Expand Down
6 changes: 4 additions & 2 deletions input/ut_fdw_init.source → expected/ut_fdw_init.out
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
\getenv abs_srcdir PG_ABS_SRCDIR
\set csv_path :abs_srcdir '/ut-fdw.csv'
CREATE EXTENSION file_fdw;
CREATE SERVER test_server
FOREIGN DATA WRAPPER file_fdw;
CREATE FOREIGN TABLE s0.sft0(id integer)
SERVER test_server
OPTIONS (filename '@abs_srcdir@/ut-fdw.csv',
OPTIONS (filename :'csv_path',
format 'csv');
\! cp @abs_srcdir@/input/ut-fdw.csv @abs_srcdir@/ut-fdw.csv
\! cp $PG_ABS_SRCDIR/input/ut-fdw.csv $PG_ABS_SRCDIR/ut-fdw.csv
Loading