Skip to content

Commit dc25f7b

Browse files
committed
comments, rework pg_hba func
1 parent 8167a63 commit dc25f7b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

internal/controller/postgrescluster/metrics_setup.sql

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,16 @@ IF p_known_hba_hash IS NOT NULL THEN
302302
v_valid := 0;
303303
END IF;
304304

305-
IF (v_hba_hash_old IS NOT NULL) AND (v_hba_hash != v_hba_hash_old) THEN
306-
v_valid := 1;
305+
/* If the table is not empty or a manual hash was given,
306+
* then we want to compare the old hash (from the table)
307+
* with the new hash: if those differ, then we set the validity to 1;
308+
* if they are the same, then we honor what the validity was
309+
* in the table (which would be 1).
310+
*/
311+
IF (v_hba_hash_old IS NOT NULL) THEN
312+
IF (v_hba_hash != v_hba_hash_old) THEN
313+
v_valid := 1;
314+
END IF;
307315
ELSE
308316
v_valid := 0;
309317
END IF;

0 commit comments

Comments
 (0)