mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
specify text type in test SQL
Older version of postgres fail otherwise.
This commit is contained in:
@@ -192,7 +192,7 @@ def test_finalize_import(tokenizer_factory, temp_db_conn,
|
|||||||
temp_db_cursor, test_config, sql_preprocessor_cfg):
|
temp_db_cursor, test_config, sql_preprocessor_cfg):
|
||||||
func_file = test_config.lib_dir.sql / 'tokenizer' / 'legacy_tokenizer_indices.sql'
|
func_file = test_config.lib_dir.sql / 'tokenizer' / 'legacy_tokenizer_indices.sql'
|
||||||
func_file.write_text("""CREATE FUNCTION test() RETURNS TEXT
|
func_file.write_text("""CREATE FUNCTION test() RETURNS TEXT
|
||||||
AS $$ SELECT 'b' $$ LANGUAGE SQL""")
|
AS $$ SELECT 'b'::text $$ LANGUAGE SQL""")
|
||||||
|
|
||||||
tok = tokenizer_factory()
|
tok = tokenizer_factory()
|
||||||
tok.init_new_db(test_config)
|
tok.init_new_db(test_config)
|
||||||
|
|||||||
@@ -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 = test_config.lib_dir.sql / 'tokenizer' / 'legacy_tokenizer_indices.sql'
|
||||||
func_file.write_text("""CREATE FUNCTION test() RETURNS TEXT
|
func_file.write_text("""CREATE FUNCTION test() RETURNS TEXT
|
||||||
AS $$ SELECT 'b' $$ LANGUAGE SQL""")
|
AS $$ SELECT 'b'::text $$ LANGUAGE SQL""")
|
||||||
|
|
||||||
tok = tokenizer_factory()
|
tok = tokenizer_factory()
|
||||||
tok.init_new_db(test_config)
|
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.
|
# Inject a bad transliteration.
|
||||||
temp_db_cursor.execute("""CREATE OR REPLACE FUNCTION make_standard_name(name TEXT)
|
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
|
assert tok.check_database(False) is not None
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ class TestSetupSQL:
|
|||||||
def test_create_table_triggers(self, temp_db_conn, temp_db_cursor):
|
def test_create_table_triggers(self, temp_db_conn, temp_db_cursor):
|
||||||
self.write_sql('table-triggers.sql',
|
self.write_sql('table-triggers.sql',
|
||||||
"""CREATE FUNCTION test() RETURNS TEXT
|
"""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)
|
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):
|
def test_create_partition_tables(self, temp_db_conn, temp_db_cursor):
|
||||||
self.write_sql('partition-tables.src.sql',
|
self.write_sql('partition-tables.src.sql',
|
||||||
"""CREATE FUNCTION test() RETURNS TEXT
|
"""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)
|
database_import.create_partition_tables(temp_db_conn, self.config)
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ def test_recompute_importance(placex_table, table_factory, temp_db_conn, temp_db
|
|||||||
osm_type varchar(1), osm_id BIGINT,
|
osm_type varchar(1), osm_id BIGINT,
|
||||||
OUT importance FLOAT,
|
OUT importance FLOAT,
|
||||||
OUT wikipedia TEXT)
|
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)
|
refresh.recompute_importance(temp_db_conn)
|
||||||
|
|||||||
Reference in New Issue
Block a user