对于制表符分隔的文本,PostgreSQL的string_to_array命令应使用什么分隔符? [英] What delimiter should be used for string_to_array command at PostgreSQL for a tab separated text?

查看:538
本文介绍了对于制表符分隔的文本,PostgreSQL的string_to_array命令应使用什么分隔符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查询一个单列表,查询的输出为text类型。我想检查结果的基数。我正在使用 string_to_array 命令,但是我不知道应该为分隔符输入什么。以下两个命令不起作用:

I'm querying a one-column table, the output of the query is of type text. I want to check the cardinality of the results. I'm using the string_to_array command, but I don't know what I should put for the delimiter. The following two commands don't work:

select rec from papers_stg where cardinality(string_to_array(rec,'    ')) <> 11
select rec from papers_stg where cardinality(string_to_array(rec,'\t')) <> 11

这是表papers_stg的前两行:

Here are the first two rows of table papers_stg:

7B5EDC52        Antibacterial Activity and Post-Antibiotic Effect of Flurithromycin Compared with Other Macrolides and Penicillins Against Periodontal Pathogens        antibacterial activity and post antibiotic effect of flurithromycin compared with other macrolides and penicillins against periodontal pathogens        2013    2013/07/18      10.1179/joc.2001.13.3.255       Journal of Chemotherapy journal of chemotherapy 0794F580                19555
7932AE5F        In Vitro Activity of Cefdinir against Respiratory Pathogens Isolated in Sicily with Reference to Beta-Lactamase Production      in vitro activity of cefdinir against respiratory pathogens isolated in sicily with reference to beta lactamase production      2013    2013/07/18              Journal of Chemotherapy journal of chemotherapy 0794F580                19555

这是表说明:

 Table "public.papers_stg"
 Column | Type | Modifiers 
--------+------+-----------
 rec    | text | 


推荐答案

带有C样式转义符的字符串常量

string_to_array(rec, E'\t')

这篇关于对于制表符分隔的文本,PostgreSQL的string_to_array命令应使用什么分隔符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆