我正在尝试用select:
INSERT INTO global_search (entity_id, entity_type, search_content)
SELECT id, 'user', "username"
FROM "user"
WHERE "id" = 1
ON CONFLICT (entity_id) DO UPDATE
SET search_content = excluded.username
但是我得到以下错误:
ERROR: column excluded.username does not exist
LINE 8: SET search_content = excluded.username
这似乎应该对这个问题有效。如果我删除ON冲突位,它工作得很好。
我正在运行postgresql 13.4.
就是EXCLUDED.search_content
。列名称是INSERT
要进入的表中目标列的名称。