postgresql - 创建表时函数 pg_catalog.btrim(numeric, unknown) 不存在
问题描述
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
解决方案
这是您的问题的解决方法,查看可能对您有用:
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;
推荐阅读
- javascript - 从字符串中删除一个单词,直到下一次出现空格
- gitlab - 如何在 GITLAB CI 中存储不同作业的结果?
- node.js - 使用锁定处理多个发布请求
- build.gradle - gradle 中的并行构建执行
- android - 如何为用户上传一个全新的应用程序来替换设备中的旧现有版本?
- flutter - 按下按钮时如何在动态 GridView 中显示文本?
- python - 如何修复 Python 中的“TypeError:'str' object is not callable”错误?
- php - 从 python 获取请求不会在 php 上发送
- php - 在刀片中进行迭代的 for 循环
- php - 尝试使用 ErrorDocument 处理请求时遇到 404 Not Found 错误