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

Commit091a971

Browse files
committed
Modify query on pg_hba_file_rules to check for errors in regression tests
The regression tests include a query to check the execution path ofpg_hba_file_rules, but it has never checked that a given cluster hascorrect contents in pg_hba.conf. This commit extends the query ofpg_hba_file_rules to report any errors if anything bad is found. ForEXEC_BACKEND builds, any connection attempt would fail when loadingpg_hba.conf if any incorrect content is found when parsed, so a failurewould be detected before even running this query. However, this canbecome handy for clusters where pg_hba.conf can be reloaded, where newconnection attempts are not subject to a fresh loading of pg_hba.conf.Author: Julien Rouhaud, based on an idea from meDiscussion:https://postgr.es/m/YkFhpydhyeNNo3Xl@paquier.xyz
1 parent33a3776 commit091a971

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

‎src/test/regress/expected/sysviews.out

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ select count(*) >= 0 as ok from pg_file_settings;
4848
t
4949
(1 row)
5050

51-
-- There will surely be at least one rule
52-
select count(*) > 0 as ok from pg_hba_file_rules;
53-
ok
54-
----
55-
t
51+
-- There will surely be at least one rule, with no errors.
52+
select count(*) > 0 as ok, count(*) FILTER (WHERE error IS NOT NULL) = 0 AS no_err
53+
from pg_hba_file_rules;
54+
ok | no_err
55+
----+--------
56+
t | t
5657
(1 row)
5758

5859
-- There will surely be at least one active lock

‎src/test/regress/sql/sysviews.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ select count(*) = 0 as ok from pg_cursors;
2525

2626
selectcount(*)>=0as okfrom pg_file_settings;
2727

28-
-- There will surely be at least one rule
29-
selectcount(*)>0as okfrom pg_hba_file_rules;
28+
-- There will surely be at least one rule, with no errors.
29+
selectcount(*)>0as ok,count(*) FILTER (WHERE errorIS NOT NULL)=0AS no_err
30+
from pg_hba_file_rules;
3031

3132
-- There will surely be at least one active lock
3233
selectcount(*)>0as okfrom pg_locks;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp