public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH v13 2/8] Add tests exercising pg_ls_tmpdir..
6+ messages / 4 participants
[nested] [flat]

* [PATCH v13 2/8] Add tests exercising pg_ls_tmpdir..
@ 2020-03-10 03:40  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Justin Pryzby @ 2020-03-10 03:40 UTC (permalink / raw)

..and its backing function pg_ls_dir_files
---
 src/test/regress/expected/misc_functions.out | 7 +++++++
 src/test/regress/input/tablespace.source     | 5 +++++
 src/test/regress/output/tablespace.source    | 8 ++++++++
 src/test/regress/sql/misc_functions.sql      | 4 ++++
 4 files changed, 24 insertions(+)

diff --git a/src/test/regress/expected/misc_functions.out b/src/test/regress/expected/misc_functions.out
index d3acb98d04..903f1fe443 100644
--- a/src/test/regress/expected/misc_functions.out
+++ b/src/test/regress/expected/misc_functions.out
@@ -201,6 +201,13 @@ select count(*) > 0 from
  t
 (1 row)
 
+-- This tests the missing_ok parameter, which causes pg_ls_tmpdir to succeed even if the tmpdir doesn't exist yet
+-- The name='' condition is never true, so the function runs to completion but returns zero rows.
+select * from pg_ls_tmpdir() where name='Does not exist';
+ name | size | modification 
+------+------+--------------
+(0 rows)
+
 --
 -- Test adding a support function to a subject function
 --
diff --git a/src/test/regress/input/tablespace.source b/src/test/regress/input/tablespace.source
index a5f61a35dc..0b9cfe615e 100644
--- a/src/test/regress/input/tablespace.source
+++ b/src/test/regress/input/tablespace.source
@@ -11,6 +11,11 @@ DROP TABLESPACE regress_tblspacewith;
 -- create a tablespace we can use
 CREATE TABLESPACE regress_tblspace LOCATION '@testtablespace@';
 
+-- This tests the missing_ok parameter, which causes pg_ls_tmpdir to succeed even if the tmpdir doesn't exist yet
+-- The name='' condition is never true, so the function runs to completion but returns zero rows.
+-- The query is written to ERROR if the tablespace doesn't exist, rather than silently failing to call pg_ls_tmpdir()
+SELECT c.* FROM (SELECT oid FROM pg_tablespace b WHERE b.spcname='regress_tblspace' UNION SELECT 0 ORDER BY 1 DESC LIMIT 1) AS b , pg_ls_tmpdir(oid) AS c WHERE c.name='Does not exist';
+
 -- try setting and resetting some properties for the new tablespace
 ALTER TABLESPACE regress_tblspace SET (random_page_cost = 1.0, seq_page_cost = 1.1);
 ALTER TABLESPACE regress_tblspace SET (some_nonexistent_parameter = true);  -- fail
diff --git a/src/test/regress/output/tablespace.source b/src/test/regress/output/tablespace.source
index 162b591b31..a42714bf40 100644
--- a/src/test/regress/output/tablespace.source
+++ b/src/test/regress/output/tablespace.source
@@ -13,6 +13,14 @@ SELECT spcoptions FROM pg_tablespace WHERE spcname = 'regress_tblspacewith';
 DROP TABLESPACE regress_tblspacewith;
 -- create a tablespace we can use
 CREATE TABLESPACE regress_tblspace LOCATION '@testtablespace@';
+-- This tests the missing_ok parameter, which causes pg_ls_tmpdir to succeed even if the tmpdir doesn't exist yet
+-- The name='' condition is never true, so the function runs to completion but returns zero rows.
+-- The query is written to ERROR if the tablespace doesn't exist, rather than silently failing to call pg_ls_tmpdir()
+SELECT c.* FROM (SELECT oid FROM pg_tablespace b WHERE b.spcname='regress_tblspace' UNION SELECT 0 ORDER BY 1 DESC LIMIT 1) AS b , pg_ls_tmpdir(oid) AS c WHERE c.name='Does not exist';
+ name | size | modification 
+------+------+--------------
+(0 rows)
+
 -- try setting and resetting some properties for the new tablespace
 ALTER TABLESPACE regress_tblspace SET (random_page_cost = 1.0, seq_page_cost = 1.1);
 ALTER TABLESPACE regress_tblspace SET (some_nonexistent_parameter = true);  -- fail
diff --git a/src/test/regress/sql/misc_functions.sql b/src/test/regress/sql/misc_functions.sql
index 094e8f8296..f09c890b5d 100644
--- a/src/test/regress/sql/misc_functions.sql
+++ b/src/test/regress/sql/misc_functions.sql
@@ -60,6 +60,10 @@ select count(*) > 0 from
    where spcname = 'pg_default') pts
   join pg_database db on pts.pts = db.oid;
 
+-- This tests the missing_ok parameter, which causes pg_ls_tmpdir to succeed even if the tmpdir doesn't exist yet
+-- The name='' condition is never true, so the function runs to completion but returns zero rows.
+select * from pg_ls_tmpdir() where name='Does not exist';
+
 --
 -- Test adding a support function to a subject function
 --
-- 
2.17.0


--E0h0CbphJD8hN+Gf
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v13-0003-Add-pg_ls_dir_metadata-to-list-a-dir-with-file-m.patch"



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

* Re: Better title output for psql \dt \di etc. commands
@ 2025-02-04 14:27  Álvaro Herrera <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Álvaro Herrera @ 2025-02-04 14:27 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Greg Sabino Mullane <[email protected]>; Nathan Bossart <[email protected]>; pgsql-hackers

On 2025-Feb-03, Tom Lane wrote:

> One problem with it is that while we can leave "List of ???" out
> of the set of translatable strings easily, we can't currently
> do that for the argument of pg_log_error because it's automatically
> a gettext trigger.  I'd rather not burden translators with figuring
> out what to do with that.  Is it worth creating pg_log_error_internal,
> equivalently to elog and errmsg_internal in the backend?

At this point I would just add a "translator:" comment that explains
that the ??? bit is for unexpected cases and can be translated in the
same way.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"The problem with the future is that it keeps turning into the present"
(Hobbes)






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

* Re: Better title output for psql \dt \di etc. commands
@ 2025-02-04 16:13  Tom Lane <[email protected]>
  parent: Álvaro Herrera <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2025-02-04 16:13 UTC (permalink / raw)
  To: Álvaro Herrera <[email protected]>; +Cc: Greg Sabino Mullane <[email protected]>; Nathan Bossart <[email protected]>; pgsql-hackers

=?utf-8?Q?=C3=81lvaro?= Herrera <[email protected]> writes:
> At this point I would just add a "translator:" comment that explains
> that the ??? bit is for unexpected cases and can be translated in the
> same way.

Hmm, do we have a standard policy or comment wording about that?
I looked for "translator: ... unexpected" and didn't find any
existing comments of that sort.

			regards, tom lane






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

* Re: Better title output for psql \dt \di etc. commands
@ 2025-02-04 19:03  Álvaro Herrera <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Álvaro Herrera @ 2025-02-04 19:03 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Greg Sabino Mullane <[email protected]>; Nathan Bossart <[email protected]>; pgsql-hackers

On 2025-Feb-04, Tom Lane wrote:

> =?utf-8?Q?=C3=81lvaro?= Herrera <[email protected]> writes:
> > At this point I would just add a "translator:" comment that explains
> > that the ??? bit is for unexpected cases and can be translated in the
> > same way.
> 
> Hmm, do we have a standard policy or comment wording about that?
> I looked for "translator: ... unexpected" and didn't find any
> existing comments of that sort.

I don't remember cases of messages of that kind marked for translation,
so I'm not surprised that we don't have any such comments.  Those would
typically be elog() or the errfoo_internal() cases, I think.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"El sudor es la mejor cura para un pensamiento enfermo" (Bardia)






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

* [PATCH 2/4] Use double quotes in message
@ 2026-05-26 07:17  Kyotaro Horiguchi <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Kyotaro Horiguchi @ 2026-05-26 07:17 UTC (permalink / raw)

Replace backquotes around a symbol name in a user-facing message with
double quotes for consistency with other messages.
---
 src/interfaces/libpq/fe-protocol3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index 840e018cd18..4efa8a16ab1 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -1560,7 +1560,7 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
 	 */
 	if (expect_test_protocol_negotiation && !found_test_protocol_negotiation)
 	{
-		libpq_append_conn_error(conn, "server did not report the unsupported `_pq_.test_protocol_negotiation` parameter in its protocol negotiation message");
+		libpq_append_conn_error(conn, "server did not report the unsupported \"_pq_.test_protocol_negotiation\" parameter in its protocol negotiation message");
 		goto failure;
 	}
 
-- 
2.47.3


----Next_Part(Thu_May_28_12_16_22_2026_214)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-Add-missing-period-to-HINT-message.patch"



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

* [PATCH 2/4] Use double quotes in message
@ 2026-05-26 07:17  Kyotaro Horiguchi <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Kyotaro Horiguchi @ 2026-05-26 07:17 UTC (permalink / raw)

Replace backquotes around a symbol name in a user-facing message with
double quotes for consistency with other messages.
---
 src/interfaces/libpq/fe-protocol3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index 840e018cd18..4efa8a16ab1 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -1560,7 +1560,7 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
 	 */
 	if (expect_test_protocol_negotiation && !found_test_protocol_negotiation)
 	{
-		libpq_append_conn_error(conn, "server did not report the unsupported `_pq_.test_protocol_negotiation` parameter in its protocol negotiation message");
+		libpq_append_conn_error(conn, "server did not report the unsupported \"_pq_.test_protocol_negotiation\" parameter in its protocol negotiation message");
 		goto failure;
 	}
 
-- 
2.47.3


----Next_Part(Thu_May_28_12_16_22_2026_214)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-Add-missing-period-to-HINT-message.patch"



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


end of thread, other threads:[~2026-05-26 07:17 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 03:40 [PATCH v13 2/8] Add tests exercising pg_ls_tmpdir.. Justin Pryzby <[email protected]>
2025-02-04 14:27 Re: Better title output for psql \dt \di etc. commands Álvaro Herrera <[email protected]>
2025-02-04 16:13 ` Re: Better title output for psql \dt \di etc. commands Tom Lane <[email protected]>
2025-02-04 19:03   ` Re: Better title output for psql \dt \di etc. commands Álvaro Herrera <[email protected]>
2026-05-26 07:17 [PATCH 2/4] Use double quotes in message Kyotaro Horiguchi <[email protected]>
2026-05-26 07:17 [PATCH 2/4] Use double quotes in message Kyotaro Horiguchi <[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