public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH v16 03/10] Add tests on pg_ls_dir before changing it
3+ messages / 3 participants
[nested] [flat]

* [PATCH v16 03/10] Add tests on pg_ls_dir before changing it
@ 2020-03-17 18:16 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Justin Pryzby @ 2020-03-17 18:16 UTC (permalink / raw)

---
 src/test/regress/expected/misc_functions.out | 18 ++++++++++++++++++
 src/test/regress/sql/misc_functions.sql      |  5 +++++
 2 files changed, 23 insertions(+)

diff --git a/src/test/regress/expected/misc_functions.out b/src/test/regress/expected/misc_functions.out
index d3acb98d04..2e87c548eb 100644
--- a/src/test/regress/expected/misc_functions.out
+++ b/src/test/regress/expected/misc_functions.out
@@ -201,6 +201,24 @@ 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
 --
 -- Test adding a support function to a subject function
 --
diff --git a/src/test/regress/sql/misc_functions.sql b/src/test/regress/sql/misc_functions.sql
index 094e8f8296..f6857ad177 100644
--- a/src/test/regress/sql/misc_functions.sql
+++ b/src/test/regress/sql/misc_functions.sql
@@ -60,6 +60,11 @@ 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
+
 --
 -- Test adding a support function to a subject function
 --
-- 
2.17.0


--2FkSFaIQeDFoAt0B
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v16-0004-Add-pg_ls_dir_metadata-to-list-a-dir-with-file-m.patch"



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: psql: add an optional execution-count limit to \watch.
@ 2023-04-06 17:18 Tom Lane <[email protected]>
  2023-04-07 12:04 ` Re: pgsql: psql: add an optional execution-count limit to \watch. Alexander Korotkov <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2023-04-06 17:18 UTC (permalink / raw)
  To: [email protected]

psql: add an optional execution-count limit to \watch.

\watch can now be told to stop after N executions of the query.

With the idea that we might want to add more options to \watch
in future, this patch generalizes the command's syntax to a list
of name=value options, with the interval allowed to omit the name
for backwards compatibility.

Andrey Borodin, reviewed by Kyotaro Horiguchi, Nathan Bossart,
Michael Paquier, Yugo Nagata, and myself

Discussion: https://postgr.es/m/CAAhFRxiZ2-n_L1ErMm9AZjgmUK=qS6VHb+0SaMn8sqqbhF7How@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/00beecfe839c878abb366b68272426ed5296bc2b

Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml     |  10 +++-
src/bin/psql/command.c             | 118 +++++++++++++++++++++++++++++++------
src/bin/psql/help.c                |   2 +-
src/bin/psql/t/001_basic.pl        |  33 ++++++++---
src/test/regress/expected/psql.out |   2 +-
src/test/regress/sql/psql.sql      |   2 +-
6 files changed, 135 insertions(+), 32 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: psql: add an optional execution-count limit to \watch.
  2023-04-06 17:18 pgsql: psql: add an optional execution-count limit to \watch. Tom Lane <[email protected]>
@ 2023-04-07 12:04 ` Alexander Korotkov <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Alexander Korotkov @ 2023-04-07 12:04 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: [email protected]

Hi!

On Thu, Apr 6, 2023 at 8:18 PM Tom Lane <[email protected]> wrote:
> psql: add an optional execution-count limit to \watch.
>
> \watch can now be told to stop after N executions of the query.

This commit makes tests fail for me.  psql parses 'i' option of
'\watch' using locale-aware strtod(), but 001_basic.pl uses hard-coded
decimal separator.  The proposed fix is attached.

------
Regards,
Alexander Korotkov


Attachments:

  [application/octet-stream] psql_test_fix.patch (493B, ../../CAPpHfdv+10Uk6FWjsh3+ju7kHYr76LaRXbYayXmrM7FBU-=Hgg@mail.gmail.com/2-psql_test_fix.patch)
  download | inline diff:
diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl
index 56b1e3e4a6f..52b982a5f80 100644
--- a/src/bin/psql/t/001_basic.pl
+++ b/src/bin/psql/t/001_basic.pl
@@ -3,6 +3,7 @@
 
 use strict;
 use warnings;
+use locale;
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
@@ -353,7 +354,7 @@ psql_like(
 # Check \watch
 psql_like(
 	$node,
-	'SELECT 1 \watch c=3 i=0.01',
+	sprintf('SELECT 1 \watch c=3 i=%g', 0.01),
 	qr/1\n1\n1/,
 	'\watch with 3 iterations');
 


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2023-04-07 12:04 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 18:16 [PATCH v16 03/10] Add tests on pg_ls_dir before changing it Justin Pryzby <[email protected]>
2023-04-06 17:18 pgsql: psql: add an optional execution-count limit to \watch. Tom Lane <[email protected]>
2023-04-07 12:04 ` Re: pgsql: psql: add an optional execution-count limit to \watch. Alexander Korotkov <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox