如何在postgres中执行H2db生成的语句

时间:2016-03-09 07:00:42

标签: postgresql jdbc h2db

从h2生成的统计数据

 INSERT INTO EPSG_ALIAS
   (ALIAS_CODE, OBJECT_TABLE_NAME, OBJECT_CODE, NAMING_SYSTEM_CODE, ALIAS, REMARKS) 
 VALUES 
   (1431, 'Datum', 6123, 7300, STRINGDECODE('Kartastokoordinaattij\ufffdrjestelm\ufffd (1966)'), NULL);

当我在postgresql中执行上述语句时,我收到以下错误。

ERROR: function stringdecode(unknown) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Character: 140

1 个答案:

答案 0 :(得分:1)

STRINGDECODE是H2读取“ ASCII写的UTF-8字符”的方式。

对于Postgres,在字符串前加一个简单的'E':

STRINGDECODE('Kartastokoordinaattij\ufffdrjestelm\ufffd (1966)')

成为

E'Kartastokoordinaattij\ufffdrjestelm\ufffd (1966)'