Mysql 如何在postgresql中Rexep拆分后插入新行
我有一张这样的桌子,在这个问题上: 我想在拆分行之后插入新行。如何在postgresql中实现这一点?我可以使用Mysql 如何在postgresql中Rexep拆分后插入新行,mysql,database,postgresql,Mysql,Database,Postgresql,我有一张这样的桌子,在这个问题上: 我想在拆分行之后插入新行。如何在postgresql中实现这一点?我可以使用 SELECT "ID", regexp_split_to_table("Cars", '(([,;] (?!damaged))|[,;]? and )') "Cars" FROM mytable; 但是我不知道如何修改表格 begin; create temporary table mytable_temp after commit drop as -- Here is SQ
SELECT "ID",
regexp_split_to_table("Cars", '(([,;] (?!damaged))|[,;]? and )') "Cars"
FROM mytable;
但是我不知道如何修改表格
begin;
create temporary table mytable_temp after commit drop as
-- Here is SQL you povided so no any questions about it to me :)
SELECT "ID",
regexp_split_to_table("Cars", '(([,;] (?!damaged))|[,;]? and )') "Cars"
FROM mytable;
-- Here we will deal with fake table instead of your original table
-- to prevent data lost
create mytable_new as
select * from mytable_temp;
commit;
检查是否mytable\u new
包含正确的数据,然后
-- truncate mytable;
-- insert into mytable select * from mytable_new;
-- drop table mytable_new;
在哪里插入行?