From 5a9fb6eaf73ebfc5a82e553744328ade60b50f8a Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Fri, 3 Dec 2021 12:01:53 +0100 Subject: [PATCH] specify text type in test SQL Older version of postgres fail otherwise. --- test/python/tokenizer/test_icu.py | 2 +- test/python/tokenizer/test_legacy.py | 4 ++-- test/python/tools/test_database_import.py | 4 ++-- test/python/tools/test_refresh.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/python/tokenizer/test_icu.py b/test/python/tokenizer/test_icu.py index 3fe06110..642aaceb 100644 --- a/test/python/tokenizer/test_icu.py +++ b/test/python/tokenizer/test_icu.py @@ -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) diff --git a/test/python/tokenizer/test_legacy.py b/test/python/tokenizer/test_legacy.py index 45cd94aa..a16756df 100644 --- a/test/python/tokenizer/test_legacy.py +++ b/test/python/tokenizer/test_legacy.py @@ -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 diff --git a/test/python/tools/test_database_import.py b/test/python/tools/test_database_import.py index f825cdf5..6d6d75fd 100644 --- a/test/python/tools/test_database_import.py +++ b/test/python/tools/test_database_import.py @@ -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) diff --git a/test/python/tools/test_refresh.py b/test/python/tools/test_refresh.py index b6f18e0a..c15c3614 100644 --- a/test/python/tools/test_refresh.py +++ b/test/python/tools/test_refresh.py @@ -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) -- 2.39.5