我在尝试插入用户表时遇到问题。
DO $$
DECLARE newId bigint;
BEGIN
INSERT INTO users("email","bio","status","created_by","updated_by")
VALUES ('tetsinsert@gmail.com','❄❄Haocute$$','accepted','1','1')
RETURNING id INTO newId;
UPDATE synces SET "version" = "version" + 1, updated_at = now(),
new_id = newId WHERE "old_id" = 98525 and table_name = 'users';
IF NOT FOUND THEN
INSERT INTO synces
(created_at, updated_at, deleted_at, table_name, old_id, new_id, "version")
VALUES(now(), now(), null, 'users', 98525, newId, 0);
END IF;
END $$
感谢您阅读我的帖子。
2条答案
按热度按时间pjngdqdw1#
有两种可能性:
1.使用不同的自定义字符串分隔符:
1.可以使用带有转义值的扩展字符串:
ua4mk5z42#
我找到了解决办法