Skip to content

Commit e8fa985

Browse files
committed
Use environment variable for database name where psql is called from the tests, to make test run with both values of USE_MODULE_DB makefile variable
1 parent 73c1c9d commit e8fa985

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

contrib/pg_hint_plan/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ top_builddir = ../..
3030
include $(top_builddir)/src/Makefile.global
3131
include $(top_srcdir)/contrib/contrib-global.mk
3232
override CFLAGS += -I$(top_srcdir)/src/pl/plpgsql/src
33-
#REGRESS = init base_plan
3433
endif
34+
ifneq ($(USE_MODULE_DB),)
35+
PGDATABASE=$(CONTRIB_TESTDB_MODULE)
36+
else
37+
PGDATABASE=$(CONTRIB_TESTDB)
38+
endif
39+
export PGDATABASE
3540

3641
STARBALL96 = pg_hint_plan96-$(HINTPLANVER).tar.gz
3742
STARBALLS = $(STARBALL96)

contrib/pg_hint_plan/expected/ut-S.out

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5026,7 +5026,7 @@ error hint:
50265026
---- No. S-3-5 not used index
50275027
----
50285028
-- No. S-3-5-1
5029-
\! psql contrib_regression -c "/*+IndexScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
5029+
\! psql ${PGDATABASE} -c "/*+IndexScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
50305030
LOG: statement: /*+IndexScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100
50315031
LOG: available indexes for IndexScan(ti1): ti1_pred
50325032
LOG: pg_hint_plan:
@@ -5043,7 +5043,7 @@ error hint:
50435043
(2 rows)
50445044

50455045
-- No. S-3-5-2
5046-
\! psql contrib_regression -c "/*+BitmapScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
5046+
\! psql ${PGDATABASE} -c "/*+BitmapScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
50475047
LOG: statement: /*+BitmapScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100
50485048
LOG: available indexes for BitmapScan(ti1): ti1_pred
50495049
LOG: pg_hint_plan:
@@ -5060,7 +5060,7 @@ error hint:
50605060
(2 rows)
50615061

50625062
-- No. S-3-5-3
5063-
\! psql contrib_regression -c "/*+IndexOnlyScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
5063+
\! psql ${PGDATABASE} -c "/*+IndexOnlyScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
50645064
LOG: statement: /*+IndexOnlyScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100
50655065
LOG: available indexes for IndexOnlyScan(ti1): ti1_pred
50665066
LOG: pg_hint_plan:
@@ -5077,7 +5077,7 @@ error hint:
50775077
(2 rows)
50785078

50795079
-- No. S-3-5-4
5080-
\! psql contrib_regression -c "/*+IndexScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
5080+
\! psql ${PGDATABASE} -c "/*+IndexScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
50815081
LOG: statement: /*+IndexScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100
50825082
LOG: available indexes for IndexScan(ti1):
50835083
LOG: pg_hint_plan:
@@ -5094,7 +5094,7 @@ error hint:
50945094
(2 rows)
50955095

50965096
-- No. S-3-5-5
5097-
\! psql contrib_regression -c "/*+BitmapScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
5097+
\! psql ${PGDATABASE} -c "/*+BitmapScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
50985098
LOG: statement: /*+BitmapScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100
50995099
LOG: available indexes for BitmapScan(ti1):
51005100
LOG: pg_hint_plan:
@@ -5111,7 +5111,7 @@ error hint:
51115111
(2 rows)
51125112

51135113
-- No. S-3-5-6
5114-
\! psql contrib_regression -c "/*+IndexOnlyScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
5114+
\! psql ${PGDATABASE} -c "/*+IndexOnlyScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
51155115
LOG: statement: /*+IndexOnlyScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100
51165116
LOG: available indexes for IndexOnlyScan(ti1):
51175117
LOG: pg_hint_plan:
@@ -5136,7 +5136,7 @@ LOG: statement: EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
51365136
Index Cond: (c1 = 1)
51375137
(2 rows)
51385138

5139-
\! psql contrib_regression -c "/*+TidScan(t1)*/ EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1" | grep -v "Planning time:"
5139+
\! psql ${PGDATABASE} -c "/*+TidScan(t1)*/ EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1" | grep -v "Planning time:"
51405140
LOG: statement: /*+TidScan(t1)*/ EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1
51415141
LOG: pg_hint_plan:
51425142
used hint:

contrib/pg_hint_plan/sql/ut-S.sql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -807,26 +807,26 @@ EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE c2 >= 1;
807807
----
808808

809809
-- No. S-3-5-1
810-
\! psql contrib_regression -c "/*+IndexScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
810+
\! psql ${PGDATABASE} -c "/*+IndexScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
811811

812812
-- No. S-3-5-2
813-
\! psql contrib_regression -c "/*+BitmapScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
813+
\! psql ${PGDATABASE} -c "/*+BitmapScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
814814

815815
-- No. S-3-5-3
816-
\! psql contrib_regression -c "/*+IndexOnlyScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
816+
\! psql ${PGDATABASE} -c "/*+IndexOnlyScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
817817

818818
-- No. S-3-5-4
819-
\! psql contrib_regression -c "/*+IndexScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
819+
\! psql ${PGDATABASE} -c "/*+IndexScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
820820

821821
-- No. S-3-5-5
822-
\! psql contrib_regression -c "/*+BitmapScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
822+
\! psql ${PGDATABASE} -c "/*+BitmapScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
823823

824824
-- No. S-3-5-6
825-
\! psql contrib_regression -c "/*+IndexOnlyScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
825+
\! psql ${PGDATABASE} -c "/*+IndexOnlyScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
826826

827827
-- No. S-3-5-7
828828
EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
829-
\! psql contrib_regression -c "/*+TidScan(t1)*/ EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1" | grep -v "Planning time:"
829+
\! psql ${PGDATABASE} -c "/*+TidScan(t1)*/ EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1" | grep -v "Planning time:"
830830

831831
----
832832
---- No. S-3-6 query structure

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