`select regexp_replace(<column>,'\ s +','')`想要显式类型转换,但是如何?</column>

时间:2014-02-11 12:46:15

标签: postgresql amazon-redshift

查询:

update enquiry_address_data  
set address_line_1 = upper(regexp_replace(btrim(address_line_1), '\s+', ' '));

返回

ERROR: function regexp_replace(text, "unknown", "unknown") does not exist
Hint: No function matches the given name and argument types. You may need to add explicit type casts.

我添加了类似的显式类型转换:

update enquiry_address_data  
set address_line_1 = upper(regexp_replace(btrim(address_line_1), '\s+' :: text, ' ' :: text));

我还是

ERROR: function regexp_replace(text, character varying, character varying) does not exist
Hint: No function matches the given name and argument types. You may need to add explicit type casts.

我正在使用连接到Amazon RedShift实例的PostgreSql 9.3 JDBC驱动程序

2 个答案:

答案 0 :(得分:3)

Redshift没有regexp_replace,它减少了旧PostgreSQL版本的分支,并增加了一些东西。

请参阅Redshift文档。另请参阅\df pg_catalog.*\df pg_catalog.*regexp*

答案 1 :(得分:2)

regexp_replace是红移中的众多unsupported PostgreSQL functions之一。

逐个添加这些功能 - 看看documentation history