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

Commitd10fad9

Browse files
committed
Adjust new pg_read_file() test cases for more portability.
It's allowed for an installation to remove postgresql.auto.conf,so don't rely on that being present. Instead probe whether we canread postmaster.pid. (If you've removed that, you broke the datadirectory's multiple-postmaster interlock, not to mention pg_ctl.)Per gripe from Michael Paquier.Discussion:https://postgr.es/m/YuSZTsoBMObyY+vT@paquier.xyz
1 parent212bdc0 commitd10fad9

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,16 +373,16 @@ select count(*) >= 0 as ok from pg_ls_archive_statusdir();
373373
(1 row)
374374

375375
-- pg_read_file()
376-
select length(pg_read_file('postgresql.auto.conf')) >30;
376+
select length(pg_read_file('postmaster.pid')) >20;
377377
?column?
378378
----------
379379
t
380380
(1 row)
381381

382-
select length(pg_read_file('postgresql.auto.conf', 1,30));
382+
select length(pg_read_file('postmaster.pid', 1,20));
383383
length
384384
--------
385-
30
385+
20
386386
(1 row)
387387

388388
-- Test missing_ok
@@ -400,16 +400,16 @@ ERROR: requested length cannot be negative
400400
select pg_read_file('does not exist', 0, -1, true); -- error
401401
ERROR: requested length cannot be negative
402402
-- pg_read_binary_file()
403-
select length(pg_read_binary_file('postgresql.auto.conf')) >30;
403+
select length(pg_read_binary_file('postmaster.pid')) >20;
404404
?column?
405405
----------
406406
t
407407
(1 row)
408408

409-
select length(pg_read_binary_file('postgresql.auto.conf', 1,30));
409+
select length(pg_read_binary_file('postmaster.pid', 1,20));
410410
length
411411
--------
412-
30
412+
20
413413
(1 row)
414414

415415
-- Test missing_ok
@@ -427,7 +427,7 @@ ERROR: requested length cannot be negative
427427
select pg_read_binary_file('does not exist', 0, -1, true); -- error
428428
ERROR: requested length cannot be negative
429429
-- pg_stat_file()
430-
select size >30, isdir from pg_stat_file('postgresql.auto.conf');
430+
select size >20, isdir from pg_stat_file('postmaster.pid');
431431
?column? | isdir
432432
----------+-------
433433
t | f

‎src/test/regress/sql/misc_functions.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ from (select pg_ls_waldir() w) ss where length((w).name) = 24 limit 1;
124124
selectcount(*)>=0as okfrom pg_ls_archive_statusdir();
125125

126126
-- pg_read_file()
127-
select length(pg_read_file('postgresql.auto.conf'))>30;
128-
select length(pg_read_file('postgresql.auto.conf',1,30));
127+
select length(pg_read_file('postmaster.pid'))>20;
128+
select length(pg_read_file('postmaster.pid',1,20));
129129
-- Test missing_ok
130130
select pg_read_file('does not exist');-- error
131131
select pg_read_file('does not exist', true) ISNULL;-- ok
@@ -134,8 +134,8 @@ select pg_read_file('does not exist', 0, -1); -- error
134134
select pg_read_file('does not exist',0,-1, true);-- error
135135

136136
-- pg_read_binary_file()
137-
select length(pg_read_binary_file('postgresql.auto.conf'))>30;
138-
select length(pg_read_binary_file('postgresql.auto.conf',1,30));
137+
select length(pg_read_binary_file('postmaster.pid'))>20;
138+
select length(pg_read_binary_file('postmaster.pid',1,20));
139139
-- Test missing_ok
140140
select pg_read_binary_file('does not exist');-- error
141141
select pg_read_binary_file('does not exist', true) ISNULL;-- ok
@@ -144,7 +144,7 @@ select pg_read_binary_file('does not exist', 0, -1); -- error
144144
select pg_read_binary_file('does not exist',0,-1, true);-- error
145145

146146
-- pg_stat_file()
147-
select size>30, isdirfrom pg_stat_file('postgresql.auto.conf');
147+
select size>20, isdirfrom pg_stat_file('postmaster.pid');
148148

149149
-- pg_ls_dir()
150150
select*from (select pg_ls_dir('.') a) awhere a='base'limit1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp