Skip to content

Commit 73c1c9d

Browse files
committed
pg_hint_plan - temporarily disable output of LOG messages to console in tests during \d execution, because \d queries contain oids which are different on check and installcheck stages, and these queries are not interesting during tests of this extension
1 parent 5cf8053 commit 73c1c9d

File tree

4 files changed

+10
-94
lines changed

4 files changed

+10
-94
lines changed

contrib/pg_hint_plan/expected/ut-A.out

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -157,53 +157,9 @@ LOG: statement: EXPLAIN (COSTS false) SELECT * /*+SeqScan(t1)*/ FROM s1.t1 WHER
157157
SET pg_hint_plan.enable_hint_table TO on;
158158
LOG: statement: SET pg_hint_plan.enable_hint_table TO on;
159159
-- No. A-6-1-1
160+
SET client_min_messages TO INFO;
161+
LOG: statement: SET client_min_messages TO INFO;
160162
\d hint_plan.hints
161-
LOG: statement: SELECT c.oid,
162-
n.nspname,
163-
c.relname
164-
FROM pg_catalog.pg_class c
165-
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
166-
WHERE c.relname ~ '^(hints)$'
167-
AND n.nspname ~ '^(hint_plan)$'
168-
ORDER BY 2, 3;
169-
LOG: statement: SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, c.relhasoids, '', c.reltablespace, CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, c.relpersistence, c.relreplident
170-
FROM pg_catalog.pg_class c
171-
LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)
172-
WHERE c.oid = '17965';
173-
LOG: statement: SELECT a.attname,
174-
pg_catalog.format_type(a.atttypid, a.atttypmod),
175-
(SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128)
176-
FROM pg_catalog.pg_attrdef d
177-
WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef),
178-
a.attnotnull, a.attnum,
179-
(SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t
180-
WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation,
181-
NULL AS indexdef,
182-
NULL AS attfdwoptions
183-
FROM pg_catalog.pg_attribute a
184-
WHERE a.attrelid = '17965' AND a.attnum > 0 AND NOT a.attisdropped
185-
ORDER BY a.attnum;
186-
LOG: statement: SELECT c2.relname, i.indisprimary, i.indisunique, i.indisclustered, i.indisvalid, pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),
187-
pg_catalog.pg_get_constraintdef(con.oid, true), contype, condeferrable, condeferred, i.indisreplident, c2.reltablespace
188-
FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i
189-
LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x'))
190-
WHERE c.oid = '17965' AND c.oid = i.indrelid AND i.indexrelid = c2.oid
191-
ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname;
192-
LOG: statement: SELECT pol.polname,
193-
CASE WHEN pol.polroles = '{0}' THEN NULL ELSE array_to_string(array(select rolname from pg_roles where oid = any (pol.polroles) order by 1),',') END,
194-
pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),
195-
pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid),
196-
CASE pol.polcmd
197-
WHEN 'r' THEN 'SELECT'
198-
WHEN 'a' THEN 'INSERT'
199-
WHEN 'w' THEN 'UPDATE'
200-
WHEN 'd' THEN 'DELETE'
201-
WHEN '*' THEN 'ALL'
202-
END AS cmd
203-
FROM pg_catalog.pg_policy pol
204-
WHERE pol.polrelid = '17965' ORDER BY 1;
205-
LOG: statement: SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhparent AND i.inhrelid = '17965' ORDER BY inhseqno;
206-
LOG: statement: SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhrelid AND i.inhparent = '17965' ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;
207163
Table "hint_plan.hints"
208164
Column | Type | Modifiers
209165
-------------------+---------+--------------------------------------------------------------
@@ -215,6 +171,7 @@ Indexes:
215171
"hints_pkey" PRIMARY KEY, btree (id)
216172
"hints_norm_and_app" UNIQUE, btree (norm_query_string, application_name)
217173

174+
SET client_min_messages TO LOG;
218175
----
219176
---- No. A-6-2 search condition
220177
----

contrib/pg_hint_plan/expected/ut-S.out

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4220,53 +4220,9 @@ error hint:
42204220
----
42214221
---- No. S-3-4 index type
42224222
----
4223+
SET client_min_messages TO INFO;
4224+
LOG: statement: SET client_min_messages TO INFO;
42234225
\d s1.ti1
4224-
LOG: statement: SELECT c.oid,
4225-
n.nspname,
4226-
c.relname
4227-
FROM pg_catalog.pg_class c
4228-
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
4229-
WHERE c.relname ~ '^(ti1)$'
4230-
AND n.nspname ~ '^(s1)$'
4231-
ORDER BY 2, 3;
4232-
LOG: statement: SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, c.relhasoids, '', c.reltablespace, CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, c.relpersistence, c.relreplident
4233-
FROM pg_catalog.pg_class c
4234-
LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)
4235-
WHERE c.oid = '17867';
4236-
LOG: statement: SELECT a.attname,
4237-
pg_catalog.format_type(a.atttypid, a.atttypmod),
4238-
(SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128)
4239-
FROM pg_catalog.pg_attrdef d
4240-
WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef),
4241-
a.attnotnull, a.attnum,
4242-
(SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t
4243-
WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation,
4244-
NULL AS indexdef,
4245-
NULL AS attfdwoptions
4246-
FROM pg_catalog.pg_attribute a
4247-
WHERE a.attrelid = '17867' AND a.attnum > 0 AND NOT a.attisdropped
4248-
ORDER BY a.attnum;
4249-
LOG: statement: SELECT c2.relname, i.indisprimary, i.indisunique, i.indisclustered, i.indisvalid, pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),
4250-
pg_catalog.pg_get_constraintdef(con.oid, true), contype, condeferrable, condeferred, i.indisreplident, c2.reltablespace
4251-
FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i
4252-
LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x'))
4253-
WHERE c.oid = '17867' AND c.oid = i.indrelid AND i.indexrelid = c2.oid
4254-
ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname;
4255-
LOG: statement: SELECT pol.polname,
4256-
CASE WHEN pol.polroles = '{0}' THEN NULL ELSE array_to_string(array(select rolname from pg_roles where oid = any (pol.polroles) order by 1),',') END,
4257-
pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),
4258-
pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid),
4259-
CASE pol.polcmd
4260-
WHEN 'r' THEN 'SELECT'
4261-
WHEN 'a' THEN 'INSERT'
4262-
WHEN 'w' THEN 'UPDATE'
4263-
WHEN 'd' THEN 'DELETE'
4264-
WHEN '*' THEN 'ALL'
4265-
END AS cmd
4266-
FROM pg_catalog.pg_policy pol
4267-
WHERE pol.polrelid = '17867' ORDER BY 1;
4268-
LOG: statement: SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhparent AND i.inhrelid = '17867' ORDER BY inhseqno;
4269-
LOG: statement: SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhrelid AND i.inhparent = '17867' ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;
42704226
Table "s1.ti1"
42714227
Column | Type | Modifiers
42724228
--------+---------+-----------
@@ -4291,6 +4247,7 @@ Indexes:
42914247
"ti1_pred" btree (lower(c4))
42924248
"ti1_ts" gin (to_tsvector('english'::regconfig, c4))
42934249

4250+
SET client_min_messages TO LOG;
42944251
EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
42954252
LOG: statement: EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
42964253
QUERY PLAN

contrib/pg_hint_plan/sql/ut-A.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ EXPLAIN (COSTS false) SELECT * /*+SeqScan(t1)*/ FROM s1.t1 WHERE t1.c1 = 1;
7070

7171
SET pg_hint_plan.enable_hint_table TO on;
7272
-- No. A-6-1-1
73+
SET client_min_messages TO INFO;
7374
\d hint_plan.hints
74-
75+
SET client_min_messages TO LOG;
7576
----
7677
---- No. A-6-2 search condition
7778
----

contrib/pg_hint_plan/sql/ut-S.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,9 @@ EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
654654
----
655655
---- No. S-3-4 index type
656656
----
657-
657+
SET client_min_messages TO INFO;
658658
\d s1.ti1
659+
SET client_min_messages TO LOG;
659660
EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c1 < 100 AND c2 = 1 AND lower(c4) = '1' AND to_tsvector('english', c4) @@ 'a & b' AND ctid = '(1,1)';
660661

661662
-- No. S-3-4-1

0 commit comments

Comments
 (0)