patch for a locale-specific bug in regression tests (REL9_1_STABLE)

Started by Tomas Vondraalmost 14 years ago6 messages
#1Tomas Vondra
tv@fuzzy.cz
1 attachment(s)

Hi,

I've noticed a locale-specific bug in regression tests, I discovered
thanks to the new "magpie" buildfarm member (testing "cs_CZ" locale).
The problem is in "foreign_data" where the output is sorted by a column,
and "cs_CZ" behaves differently from "C" and "en_US".

More precisely, in "C" it's true that ('s4' < 'sc') but that's not true
in cs_CZ (and supposedly some other locales).

I've fixed this by replacing 'sc' with 't0' which seems to fix the
ordering (and should work with other locales too). See the patch attached.

kind regards
Tomas

Attachments:

regression-foreign-data.difftext/plain; name=regression-foreign-data.diffDownload
diff --git a/src/test/regress/expected/foreign_data.out b/src/test/regress/expected/foreign_data.out
index 2b3eddf..3f6bce2 100644
--- a/src/test/regress/expected/foreign_data.out
+++ b/src/test/regress/expected/foreign_data.out
@@ -631,25 +631,25 @@ DROP SERVER s7;
 
 -- CREATE FOREIGN TABLE
 CREATE SCHEMA foreign_schema;
-CREATE SERVER sc FOREIGN DATA WRAPPER dummy;
+CREATE SERVER t0 FOREIGN DATA WRAPPER dummy;
 CREATE FOREIGN TABLE ft1 ();                                    -- ERROR
 ERROR:  syntax error at or near ";"
 LINE 1: CREATE FOREIGN TABLE ft1 ();
                                    ^
 CREATE FOREIGN TABLE ft1 () SERVER no_server;                   -- ERROR
 ERROR:  server "no_server" does not exist
-CREATE FOREIGN TABLE ft1 (c1 serial) SERVER sc;                 -- ERROR
+CREATE FOREIGN TABLE ft1 (c1 serial) SERVER t0;                 -- ERROR
 NOTICE:  CREATE FOREIGN TABLE will create implicit sequence "ft1_c1_seq" for serial column "ft1.c1"
 ERROR:  default values on foreign tables are not supported
-CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS;                -- ERROR
+CREATE FOREIGN TABLE ft1 () SERVER t0 WITH OIDS;                -- ERROR
 ERROR:  syntax error at or near "WITH OIDS"
-LINE 1: CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS;
+LINE 1: CREATE FOREIGN TABLE ft1 () SERVER t0 WITH OIDS;
                                               ^
 CREATE FOREIGN TABLE ft1 (
 	c1 integer NOT NULL,
 	c2 text,
 	c3 date
-) SERVER sc OPTIONS (delimiter ',', quote '"');
+) SERVER t0 OPTIONS (delimiter ',', quote '"');
 COMMENT ON FOREIGN TABLE ft1 IS 'ft1';
 COMMENT ON COLUMN ft1.c1 IS 'ft1.c1';
 \d+ ft1
@@ -659,14 +659,14 @@ COMMENT ON COLUMN ft1.c1 IS 'ft1.c1';
  c1     | integer | not null  | plain    | ft1.c1
  c2     | text    |           | extended | 
  c3     | date    |           | plain    | 
-Server: sc
+Server: t0
 Has OIDs: no
 
 \det+
                 List of foreign tables
  Schema | Table | Server |          Options           
 --------+-------+--------+----------------------------
- public | ft1   | sc     | {"delimiter=,","quote=\""}
+ public | ft1   | t0     | {"delimiter=,","quote=\""}
 (1 row)
 
 CREATE INDEX id_ft1_c2 ON ft1 (c2);                             -- ERROR
@@ -737,7 +737,7 @@ Foreign table "foreign_schema.foreign_table_1"
  c7               | integer | 
  c8               | text    | 
  c10              | integer | 
-Server: sc
+Server: t0
 
 -- Information schema
 SELECT * FROM information_schema.foreign_data_wrappers ORDER BY 1, 2;
@@ -761,7 +761,7 @@ SELECT * FROM information_schema.foreign_servers ORDER BY 1, 2;
  regression             | s5                  | regression                   | foo                       |                     | 15.0                   | regress_test_role
  regression             | s6                  | regression                   | foo                       |                     | 16.0                   | regress_test_indirect
  regression             | s8                  | regression                   | postgresql                |                     |                        | foreign_data_user
- regression             | sc                  | regression                   | dummy                     |                     |                        | foreign_data_user
+ regression             | t0                  | regression                   | dummy                     |                     |                        | foreign_data_user
  regression             | t1                  | regression                   | foo                       |                     |                        | regress_test_indirect
  regression             | t2                  | regression                   | foo                       |                     |                        | regress_test_role
 (7 rows)
@@ -823,7 +823,7 @@ SELECT * FROM information_schema.role_usage_grants WHERE object_type LIKE 'FOREI
 SELECT * FROM information_schema.foreign_tables ORDER BY 1, 2, 3;
  foreign_table_catalog | foreign_table_schema | foreign_table_name | foreign_server_catalog | foreign_server_name 
 -----------------------+----------------------+--------------------+------------------------+---------------------
- regression            | foreign_schema       | foreign_table_1    | regression             | sc
+ regression            | foreign_schema       | foreign_table_1    | regression             | t0
 (1 row)
 
 SELECT * FROM information_schema.foreign_table_options ORDER BY 1, 2, 3, 4;
@@ -1106,7 +1106,7 @@ DROP ROLE unprivileged_role;
 DROP ROLE regress_test_role2;
 DROP FOREIGN DATA WRAPPER postgresql CASCADE;
 DROP FOREIGN DATA WRAPPER dummy CASCADE;
-NOTICE:  drop cascades to server sc
+NOTICE:  drop cascades to server t0
 \c
 DROP ROLE foreign_data_user;
 -- At this point we should have no wrappers, no servers, and no mappings.
diff --git a/src/test/regress/sql/foreign_data.sql b/src/test/regress/sql/foreign_data.sql
index 58e5060..9899cf5 100644
--- a/src/test/regress/sql/foreign_data.sql
+++ b/src/test/regress/sql/foreign_data.sql
@@ -258,16 +258,16 @@ DROP SERVER s7;
 
 -- CREATE FOREIGN TABLE
 CREATE SCHEMA foreign_schema;
-CREATE SERVER sc FOREIGN DATA WRAPPER dummy;
+CREATE SERVER t0 FOREIGN DATA WRAPPER dummy;
 CREATE FOREIGN TABLE ft1 ();                                    -- ERROR
 CREATE FOREIGN TABLE ft1 () SERVER no_server;                   -- ERROR
-CREATE FOREIGN TABLE ft1 (c1 serial) SERVER sc;                 -- ERROR
-CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS;                -- ERROR
+CREATE FOREIGN TABLE ft1 (c1 serial) SERVER t0;                 -- ERROR
+CREATE FOREIGN TABLE ft1 () SERVER t0 WITH OIDS;                -- ERROR
 CREATE FOREIGN TABLE ft1 (
 	c1 integer NOT NULL,
 	c2 text,
 	c3 date
-) SERVER sc OPTIONS (delimiter ',', quote '"');
+) SERVER t0 OPTIONS (delimiter ',', quote '"');
 COMMENT ON FOREIGN TABLE ft1 IS 'ft1';
 COMMENT ON COLUMN ft1.c1 IS 'ft1.c1';
 \d+ ft1
#2Robert Haas
robertmhaas@gmail.com
In reply to: Tomas Vondra (#1)
Re: patch for a locale-specific bug in regression tests (REL9_1_STABLE)

On Tue, Mar 6, 2012 at 1:59 PM, Tomas Vondra <tv@fuzzy.cz> wrote:

I've noticed a locale-specific bug in regression tests, I discovered
thanks to the new "magpie" buildfarm member (testing "cs_CZ" locale).
The problem is in "foreign_data" where the output is sorted by a column,
and "cs_CZ" behaves differently from "C" and "en_US".

More precisely, in "C" it's true that ('s4' < 'sc') but that's not true
in cs_CZ (and supposedly some other locales).

I've fixed this by replacing 'sc' with 't0' which seems to fix the
ordering (and should work with other locales too). See the patch attached.

This was fixed on master in commit
3e9a2672d25aed15ae6b4a09decbd8927d069868, but that picked the name s0
rather than t0. I suggest we make the same naming decision in the
back-branch to avoid future confusion...

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

#3Tomas Vondra
tv@fuzzy.cz
In reply to: Robert Haas (#2)
Re: patch for a locale-specific bug in regression tests (REL9_1_STABLE)

On 7.3.2012 17:56, Robert Haas wrote:

On Tue, Mar 6, 2012 at 1:59 PM, Tomas Vondra <tv@fuzzy.cz> wrote:

I've noticed a locale-specific bug in regression tests, I discovered
thanks to the new "magpie" buildfarm member (testing "cs_CZ" locale).
The problem is in "foreign_data" where the output is sorted by a column,
and "cs_CZ" behaves differently from "C" and "en_US".

More precisely, in "C" it's true that ('s4' < 'sc') but that's not true
in cs_CZ (and supposedly some other locales).

I've fixed this by replacing 'sc' with 't0' which seems to fix the
ordering (and should work with other locales too). See the patch attached.

This was fixed on master in commit
3e9a2672d25aed15ae6b4a09decbd8927d069868, but that picked the name s0
rather than t0. I suggest we make the same naming decision in the
back-branch to avoid future confusion...

Yes, that's a better solution - I haven't noticed that commit. Should I
prepare a modified patch or is it possible to apply the fix from master
to this branch?

Tomas

#4Robert Haas
robertmhaas@gmail.com
In reply to: Tomas Vondra (#3)
Re: patch for a locale-specific bug in regression tests (REL9_1_STABLE)

On Wed, Mar 7, 2012 at 3:08 PM, Tomas Vondra <tv@fuzzy.cz> wrote:

On 7.3.2012 17:56, Robert Haas wrote:

On Tue, Mar 6, 2012 at 1:59 PM, Tomas Vondra <tv@fuzzy.cz> wrote:

I've noticed a locale-specific bug in regression tests, I discovered
thanks to the new "magpie" buildfarm member (testing "cs_CZ" locale).
The problem is in "foreign_data" where the output is sorted by a column,
and "cs_CZ" behaves differently from "C" and "en_US".

More precisely, in "C" it's true that ('s4' < 'sc') but that's not true
in cs_CZ (and supposedly some other locales).

I've fixed this by replacing 'sc' with 't0' which seems to fix the
ordering (and should work with other locales too). See the patch attached.

This was fixed on master in commit
3e9a2672d25aed15ae6b4a09decbd8927d069868, but that picked the name s0
rather than t0.  I suggest we make the same naming decision in the
back-branch to avoid future confusion...

Yes, that's a better solution - I haven't noticed that commit. Should I
prepare a modified patch or is it possible to apply the fix from master
to this branch?

I tried to cherry-pick it, but there were conflicts, so I guess
someone will need to go through and adjust. It's probably only 10
minutes work, but if you don't mind doing it, I'd be grateful.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

#5Tomas Vondra
tv@fuzzy.cz
In reply to: Robert Haas (#4)
1 attachment(s)
Re: patch for a locale-specific bug in regression tests (REL9_1_STABLE)

On 7.3.2012 21:39, Robert Haas wrote:

On Wed, Mar 7, 2012 at 3:08 PM, Tomas Vondra <tv@fuzzy.cz> wrote:

On 7.3.2012 17:56, Robert Haas wrote:

On Tue, Mar 6, 2012 at 1:59 PM, Tomas Vondra <tv@fuzzy.cz> wrote:

I've noticed a locale-specific bug in regression tests, I discovered
thanks to the new "magpie" buildfarm member (testing "cs_CZ" locale).
The problem is in "foreign_data" where the output is sorted by a column,
and "cs_CZ" behaves differently from "C" and "en_US".

More precisely, in "C" it's true that ('s4' < 'sc') but that's not true
in cs_CZ (and supposedly some other locales).

I've fixed this by replacing 'sc' with 't0' which seems to fix the
ordering (and should work with other locales too). See the patch attached.

This was fixed on master in commit
3e9a2672d25aed15ae6b4a09decbd8927d069868, but that picked the name s0
rather than t0. I suggest we make the same naming decision in the
back-branch to avoid future confusion...

Yes, that's a better solution - I haven't noticed that commit. Should I
prepare a modified patch or is it possible to apply the fix from master
to this branch?

I tried to cherry-pick it, but there were conflicts, so I guess
someone will need to go through and adjust. It's probably only 10
minutes work, but if you don't mind doing it, I'd be grateful.

Ok, so here's a fixed patch. I haven't used the 3e9a2672 commit
directly, because there seem to be additional changes. I've simply
renamed the 'sc' to 's0' and fixed the differences in output.

Tomas

Attachments:

regression-foreign-data.difftext/plain; name=regression-foreign-data.diffDownload
diff --git a/src/test/regress/expected/foreign_data.out b/src/test/regress/expected/foreign_data.out
index 2b3eddf..2d7e884 100644
--- a/src/test/regress/expected/foreign_data.out
+++ b/src/test/regress/expected/foreign_data.out
@@ -631,25 +631,25 @@ DROP SERVER s7;
 
 -- CREATE FOREIGN TABLE
 CREATE SCHEMA foreign_schema;
-CREATE SERVER sc FOREIGN DATA WRAPPER dummy;
+CREATE SERVER s0 FOREIGN DATA WRAPPER dummy;
 CREATE FOREIGN TABLE ft1 ();                                    -- ERROR
 ERROR:  syntax error at or near ";"
 LINE 1: CREATE FOREIGN TABLE ft1 ();
                                    ^
 CREATE FOREIGN TABLE ft1 () SERVER no_server;                   -- ERROR
 ERROR:  server "no_server" does not exist
-CREATE FOREIGN TABLE ft1 (c1 serial) SERVER sc;                 -- ERROR
+CREATE FOREIGN TABLE ft1 (c1 serial) SERVER s0;                 -- ERROR
 NOTICE:  CREATE FOREIGN TABLE will create implicit sequence "ft1_c1_seq" for serial column "ft1.c1"
 ERROR:  default values on foreign tables are not supported
-CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS;                -- ERROR
+CREATE FOREIGN TABLE ft1 () SERVER s0 WITH OIDS;                -- ERROR
 ERROR:  syntax error at or near "WITH OIDS"
-LINE 1: CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS;
+LINE 1: CREATE FOREIGN TABLE ft1 () SERVER s0 WITH OIDS;
                                               ^
 CREATE FOREIGN TABLE ft1 (
 	c1 integer NOT NULL,
 	c2 text,
 	c3 date
-) SERVER sc OPTIONS (delimiter ',', quote '"');
+) SERVER s0 OPTIONS (delimiter ',', quote '"');
 COMMENT ON FOREIGN TABLE ft1 IS 'ft1';
 COMMENT ON COLUMN ft1.c1 IS 'ft1.c1';
 \d+ ft1
@@ -659,14 +659,14 @@ COMMENT ON COLUMN ft1.c1 IS 'ft1.c1';
  c1     | integer | not null  | plain    | ft1.c1
  c2     | text    |           | extended | 
  c3     | date    |           | plain    | 
-Server: sc
+Server: s0
 Has OIDs: no
 
 \det+
                 List of foreign tables
  Schema | Table | Server |          Options           
 --------+-------+--------+----------------------------
- public | ft1   | sc     | {"delimiter=,","quote=\""}
+ public | ft1   | s0     | {"delimiter=,","quote=\""}
 (1 row)
 
 CREATE INDEX id_ft1_c2 ON ft1 (c2);                             -- ERROR
@@ -737,7 +737,7 @@ Foreign table "foreign_schema.foreign_table_1"
  c7               | integer | 
  c8               | text    | 
  c10              | integer | 
-Server: sc
+Server: s0
 
 -- Information schema
 SELECT * FROM information_schema.foreign_data_wrappers ORDER BY 1, 2;
@@ -757,11 +757,11 @@ SELECT * FROM information_schema.foreign_data_wrapper_options ORDER BY 1, 2, 3;
 SELECT * FROM information_schema.foreign_servers ORDER BY 1, 2;
  foreign_server_catalog | foreign_server_name | foreign_data_wrapper_catalog | foreign_data_wrapper_name | foreign_server_type | foreign_server_version | authorization_identifier 
 ------------------------+---------------------+------------------------------+---------------------------+---------------------+------------------------+--------------------------
+ regression             | s0                  | regression                   | dummy                     |                     |                        | foreign_data_user
  regression             | s4                  | regression                   | foo                       | oracle              |                        | foreign_data_user
  regression             | s5                  | regression                   | foo                       |                     | 15.0                   | regress_test_role
  regression             | s6                  | regression                   | foo                       |                     | 16.0                   | regress_test_indirect
  regression             | s8                  | regression                   | postgresql                |                     |                        | foreign_data_user
- regression             | sc                  | regression                   | dummy                     |                     |                        | foreign_data_user
  regression             | t1                  | regression                   | foo                       |                     |                        | regress_test_indirect
  regression             | t2                  | regression                   | foo                       |                     |                        | regress_test_role
 (7 rows)
@@ -823,7 +823,7 @@ SELECT * FROM information_schema.role_usage_grants WHERE object_type LIKE 'FOREI
 SELECT * FROM information_schema.foreign_tables ORDER BY 1, 2, 3;
  foreign_table_catalog | foreign_table_schema | foreign_table_name | foreign_server_catalog | foreign_server_name 
 -----------------------+----------------------+--------------------+------------------------+---------------------
- regression            | foreign_schema       | foreign_table_1    | regression             | sc
+ regression            | foreign_schema       | foreign_table_1    | regression             | s0
 (1 row)
 
 SELECT * FROM information_schema.foreign_table_options ORDER BY 1, 2, 3, 4;
@@ -1106,7 +1106,7 @@ DROP ROLE unprivileged_role;
 DROP ROLE regress_test_role2;
 DROP FOREIGN DATA WRAPPER postgresql CASCADE;
 DROP FOREIGN DATA WRAPPER dummy CASCADE;
-NOTICE:  drop cascades to server sc
+NOTICE:  drop cascades to server s0
 \c
 DROP ROLE foreign_data_user;
 -- At this point we should have no wrappers, no servers, and no mappings.
diff --git a/src/test/regress/sql/foreign_data.sql b/src/test/regress/sql/foreign_data.sql
index 58e5060..a76ef4f 100644
--- a/src/test/regress/sql/foreign_data.sql
+++ b/src/test/regress/sql/foreign_data.sql
@@ -258,16 +258,16 @@ DROP SERVER s7;
 
 -- CREATE FOREIGN TABLE
 CREATE SCHEMA foreign_schema;
-CREATE SERVER sc FOREIGN DATA WRAPPER dummy;
+CREATE SERVER s0 FOREIGN DATA WRAPPER dummy;
 CREATE FOREIGN TABLE ft1 ();                                    -- ERROR
 CREATE FOREIGN TABLE ft1 () SERVER no_server;                   -- ERROR
-CREATE FOREIGN TABLE ft1 (c1 serial) SERVER sc;                 -- ERROR
-CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS;                -- ERROR
+CREATE FOREIGN TABLE ft1 (c1 serial) SERVER s0;                 -- ERROR
+CREATE FOREIGN TABLE ft1 () SERVER s0 WITH OIDS;                -- ERROR
 CREATE FOREIGN TABLE ft1 (
 	c1 integer NOT NULL,
 	c2 text,
 	c3 date
-) SERVER sc OPTIONS (delimiter ',', quote '"');
+) SERVER s0 OPTIONS (delimiter ',', quote '"');
 COMMENT ON FOREIGN TABLE ft1 IS 'ft1';
 COMMENT ON COLUMN ft1.c1 IS 'ft1.c1';
 \d+ ft1
#6Robert Haas
robertmhaas@gmail.com
In reply to: Tomas Vondra (#5)
Re: patch for a locale-specific bug in regression tests (REL9_1_STABLE)

On Wed, Mar 7, 2012 at 4:02 PM, Tomas Vondra <tv@fuzzy.cz> wrote:

Ok, so here's a fixed patch. I haven't used the 3e9a2672 commit
directly, because there seem to be additional changes. I've simply
renamed the 'sc' to 's0' and fixed the differences in output.

Thanks, committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company