Older version of postgres fail otherwise.
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)
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)
# 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
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)
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)
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)