From: Justin Pryzby Date: Tue, 17 Mar 2020 13:16:24 -0500 Subject: [PATCH v34 02/15] 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 8567fcc2b45..b08e7c4a6d0 100644 --- a/src/test/regress/expected/misc_functions.out +++ b/src/test/regress/expected/misc_functions.out @@ -393,6 +393,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 3db3f8bade2..ebb0352ac68 100644 --- a/src/test/regress/sql/misc_functions.sql +++ b/src/test/regress/sql/misc_functions.sql @@ -132,6 +132,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 --smOfPzt+Qjm5bNGJ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v34-0003-Add-pg_ls_dir_metadata-to-list-a-dir-with-file-m.patch"