]> git.openstreetmap.org Git - nominatim.git/commitdiff
specify text type in test SQL
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 3 Dec 2021 11:01:53 +0000 (12:01 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 3 Dec 2021 12:56:23 +0000 (13:56 +0100)
Older version of postgres fail otherwise.

test/python/tokenizer/test_icu.py
test/python/tokenizer/test_legacy.py
test/python/tools/test_database_import.py
test/python/tools/test_refresh.py

index 3fe06110b3e3fd30b39565aab042165656c7bdaa..642aaceb82e0f55ac59d03327b252fa53e0d250c 100644 (file)
@@ -192,7 +192,7 @@ def test_finalize_import(tokenizer_factory, temp_db_conn,
                          temp_db_cursor, test_config, sql_preprocessor_cfg):
     func_file = test_config.lib_dir.sql / 'tokenizer' / 'legacy_tokenizer_indices.sql'
     func_file.write_text("""CREATE FUNCTION test() RETURNS TEXT
-                            AS $$ SELECT 'b' $$ LANGUAGE SQL""")
+                            AS $$ SELECT 'b'::text $$ LANGUAGE SQL""")
 
     tok = tokenizer_factory()
     tok.init_new_db(test_config)
index 45cd94aab27f1856d3d9ee0e238f9347a1e5e3c5..a16756df6ca1f51beb0e2f00534b13dd35a7919f 100644 (file)
@@ -179,7 +179,7 @@ def test_finalize_import(tokenizer_factory, temp_db_conn,
 
     func_file = test_config.lib_dir.sql / 'tokenizer' / 'legacy_tokenizer_indices.sql'
     func_file.write_text("""CREATE FUNCTION test() RETURNS TEXT
-                            AS $$ SELECT 'b' $$ LANGUAGE SQL""")
+                            AS $$ SELECT 'b'::text $$ LANGUAGE SQL""")
 
     tok = tokenizer_factory()
     tok.init_new_db(test_config)
@@ -227,7 +227,7 @@ def test_check_database_bad_setup(test_config, tokenizer_factory, monkeypatch,
 
     # Inject a bad transliteration.
     temp_db_cursor.execute("""CREATE OR REPLACE FUNCTION make_standard_name(name TEXT)
-                              RETURNS TEXT AS $$ SELECT 'garbage'; $$ LANGUAGE SQL""")
+                              RETURNS TEXT AS $$ SELECT 'garbage'::text; $$ LANGUAGE SQL""")
 
     assert tok.check_database(False) is not None
 
index f825cdf5853ea01b9ed38ebf1f16c4549715342b..6d6d75fdcb0f4bee7d476981b77e97e6ebadf7a4 100644 (file)
@@ -217,7 +217,7 @@ class TestSetupSQL:
     def test_create_table_triggers(self, temp_db_conn, temp_db_cursor):
         self.write_sql('table-triggers.sql',
                        """CREATE FUNCTION test() RETURNS TEXT
-                          AS $$ SELECT 'a' $$ LANGUAGE SQL""")
+                          AS $$ SELECT 'a'::text $$ LANGUAGE SQL""")
 
         database_import.create_table_triggers(temp_db_conn, self.config)
 
@@ -227,7 +227,7 @@ class TestSetupSQL:
     def test_create_partition_tables(self, temp_db_conn, temp_db_cursor):
         self.write_sql('partition-tables.src.sql',
                        """CREATE FUNCTION test() RETURNS TEXT
-                          AS $$ SELECT 'b' $$ LANGUAGE SQL""")
+                          AS $$ SELECT 'b'::text $$ LANGUAGE SQL""")
 
         database_import.create_partition_tables(temp_db_conn, self.config)
 
index b6f18e0a477ee8eea79120001dfe3a62a1a4a5a9..c15c3614fd28c571491cdf1a7a4e1cc27d7fc1ed 100644 (file)
@@ -30,6 +30,6 @@ def test_recompute_importance(placex_table, table_factory, temp_db_conn, temp_db
                                               osm_type varchar(1), osm_id BIGINT,
                                               OUT importance FLOAT,
                                               OUT wikipedia TEXT)
-                               AS $$ SELECT 0.1, 'foo' $$ LANGUAGE SQL""")
+                               AS $$ SELECT 0.1::float, 'foo'::text $$ LANGUAGE SQL""")
 
     refresh.recompute_importance(temp_db_conn)