From: Justin Pryzby Date: Tue, 17 Mar 2020 13:16:24 -0500 Subject: [PATCH v36 2/7] Add tests before changing pg_ls_* --- src/test/regress/expected/misc_functions.out | 59 ++++++++++++++++++++ src/test/regress/sql/misc_functions.sql | 15 +++++ 2 files changed, 74 insertions(+) diff --git a/src/test/regress/expected/misc_functions.out b/src/test/regress/expected/misc_functions.out index 01d1ad0b9a4..45544469af5 100644 --- a/src/test/regress/expected/misc_functions.out +++ b/src/test/regress/expected/misc_functions.out @@ -416,6 +416,65 @@ select count(*) > 0 from t (1 row) +select * from (select pg_ls_dir('.', false, true) as name) as ls where ls.name='.'; -- include_dot_dirs=true + name +------ + . +(1 row) + +select * from (select pg_ls_dir('.', false, false) as name) as ls where ls.name='.'; -- include_dot_dirs=false + name +------ +(0 rows) + +select pg_ls_dir('does not exist', true, false); -- ok with missingok=true + pg_ls_dir +----------- +(0 rows) + +select pg_ls_dir('does not exist'); -- fails with missingok=false +ERROR: could not open directory "does not exist": No such file or directory +-- Check that expected columns are present +select * from pg_ls_archive_statusdir() limit 0; + name | size | modification +------+------+-------------- +(0 rows) + +select * from pg_ls_logdir() limit 0; + name | size | modification +------+------+-------------- +(0 rows) + +select * from pg_ls_logicalmapdir() limit 0; + name | size | modification +------+------+-------------- +(0 rows) + +select * from pg_ls_logicalsnapdir() limit 0; + name | size | modification +------+------+-------------- +(0 rows) + +select * from pg_ls_replslotdir('') limit 0; + name | size | modification +------+------+-------------- +(0 rows) + +select * from pg_ls_tmpdir() limit 0; + name | size | modification +------+------+-------------- +(0 rows) + +select * from pg_ls_waldir() limit 0; + name | size | modification +------+------+-------------- +(0 rows) + +select * from pg_stat_file('.') limit 0; + size | access | modification | change | creation | isdir +------+--------+--------------+--------+----------+------- +(0 rows) + -- -- Test replication slot directory functions -- diff --git a/src/test/regress/sql/misc_functions.sql b/src/test/regress/sql/misc_functions.sql index 072fc36a1ff..59d6e517503 100644 --- a/src/test/regress/sql/misc_functions.sql +++ b/src/test/regress/sql/misc_functions.sql @@ -140,6 +140,21 @@ select count(*) > 0 from where spcname = 'pg_default') pts join pg_database db on pts.pts = db.oid; +select * from (select pg_ls_dir('.', false, true) as name) as ls where ls.name='.'; -- include_dot_dirs=true +select * from (select pg_ls_dir('.', false, false) as name) as ls where ls.name='.'; -- include_dot_dirs=false +select pg_ls_dir('does not exist', true, false); -- ok with missingok=true +select pg_ls_dir('does not exist'); -- fails with missingok=false + +-- Check that expected columns are present +select * from pg_ls_archive_statusdir() limit 0; +select * from pg_ls_logdir() limit 0; +select * from pg_ls_logicalmapdir() limit 0; +select * from pg_ls_logicalsnapdir() limit 0; +select * from pg_ls_replslotdir('') limit 0; +select * from pg_ls_tmpdir() limit 0; +select * from pg_ls_waldir() limit 0; +select * from pg_stat_file('.') limit 0; + -- -- Test replication slot directory functions -- -- 2.17.1 --4ybNbZnZ8tziJ7D6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v36-0003-Add-pg_ls_dir_metadata-to-list-a-dir-with-file-m.patch"