Remove environment sensitivity in pl/tcl regression test.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 30 Sep 2023 00:20:57 +0000 (20:20 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 30 Sep 2023 00:21:10 +0000 (20:21 -0400)
Add "-gmt 1" to our test invocations of the Tcl "clock" command,
so that they do not consult the timezone environment.  While it
doesn't really matter which timezone is used here, it does
matter that the command not fall over entirely.  We've now
discovered that at least on FreeBSD, "clock scan" will fail if
/etc/localtime is missing.  It seems worth making the test
insensitive to that.

Per Tomas Vondras' buildfarm animal dikkop.  Thanks to
Thomas Munro for the diagnosis.

Discussion: https://postgr.es/m/316d304a-1dcd-cea1-3d6c-27f794727a06@enterprisedb.com

src/pl/tcl/expected/pltcl_setup.out
src/pl/tcl/sql/pltcl_setup.sql

index ed809f02bfbbe14c6451207c3b83bc791ac4adfa..a8fdcf31256cac5f6b58cd8a6d1f4835d02a1e39 100644 (file)
@@ -119,7 +119,7 @@ CREATE OPERATOR CLASS tcl_int4_ops
 -- for initialization problems.
 --
 create function tcl_date_week(int4,int4,int4) returns text as $$
-    return [clock format [clock scan "$2/$3/$1"] -format "%U"]
+    return [clock format [clock scan "$2/$3/$1" -gmt 1] -format "%U" -gmt 1]
 $$ language pltcl immutable;
 select tcl_date_week(2010,1,26);
  tcl_date_week 
index e9f59989b5b8261b8577169103af6ee29db9aef0..b9892ea4f7607748de7a45bf084f087cd4b07c09 100644 (file)
@@ -142,7 +142,7 @@ CREATE OPERATOR CLASS tcl_int4_ops
 -- for initialization problems.
 --
 create function tcl_date_week(int4,int4,int4) returns text as $$
-    return [clock format [clock scan "$2/$3/$1"] -format "%U"]
+    return [clock format [clock scan "$2/$3/$1" -gmt 1] -format "%U" -gmt 1]
 $$ language pltcl immutable;
 
 select tcl_date_week(2010,1,26);