Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从PostgreSQL中的字符串中删除数字索引_Sql_String_Postgresql - Fatal编程技术网

从PostgreSQL中的字符串中删除数字索引

从PostgreSQL中的字符串中删除数字索引,sql,string,postgresql,Sql,String,Postgresql,我试图从所有列的字符串中删除恼人的“索引”。从维基百科下载,索引应该是指源代码 我找到的是: UPDATE table_name SET column_name = REPLACE(column,old_text,new_text) WHERE condition 但它似乎不起作用-如果3%的文本可以工作,我需要像“%[%]%”一样使用作为旧文本。 有什么想法吗?谢谢 我会选择: update t set column_name = regexp_replace(co

我试图从所有列的字符串中删除恼人的“索引”。从维基百科下载,索引应该是指源代码

我找到的是:

UPDATE 
   table_name
SET 
   column_name = REPLACE(column,old_text,new_text)
WHERE 
   condition
但它似乎不起作用-如果3%的文本可以工作,我需要像“%[%]%”一样使用
作为旧文本。 有什么想法吗?谢谢

我会选择:

update t
set column_name = regexp_replace(column_name, '\[[0-9]+\]', '')
where column_name ~ '\ [[0-9]+\]';
我不想只使用
replace()

我会选择:

update t
set column_name = regexp_replace(column_name, '\[[0-9]+\]', '')
where column_name ~ '\ [[0-9]+\]';
而不仅仅是使用
replace()