创建表时,函数pg_catalog.btrim(numeric,unknown)不存在

时间:2018-05-25 10:31:02

标签: postgresql azure azure-postgresql

psql代码:

CREATE TABLE ref_lab_cohort_level
    AS
SELECT cohort,initcap (TRIM (result_flag)) AS result_flag,
       TRIM (cohort_level) AS cohort_level
FROM temp_labs_levels;

在上面的代码中,trim是PostgreSQL的修剪函数,但它给出了如下错误:

 function pg_catalog.btrim(numeric, unknown) does not exist

1 个答案:

答案 0 :(得分:0)

以下是您的问题的解决方法,结帐可能对您有用:

create table temp_labs_levels(c varchar(200));
insert into temp_labs_levels values ('   ABC    ');
insert into temp_labs_levels values ('IJK    ');
insert into temp_labs_levels values ('    XYZ');
insert into temp_labs_levels values ('Normal TEXT');

create table ref_lab_cohort_level
as
select c,
       trim(c) c_trimmed,
       initcap(trim(c)) c_trim_initcap 
from temp_labs_levels;

输出继电器:

select * from ref_lab_cohort_level;

DEMO