Open
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
ON CONFLICT .. DO UPDATE
queries are improperly flagged as invalid syntax, and the LSP Is interpreting it as 2 separate statements (2nd starting with "UPDATE"). Putting the same syntax inside a CTE is considered valid by the LSP.
To Reproduce
write this query and observe the squiggles; it's interpreting it as two separate statements, first one ending on DO
(inclusive)
INSERT INTO foo.bar (
pk
) VALUES (
$1
) ON CONFLICT (pk) DO UPDATE SET
date_deleted = DEFAULT,
date_created = DEFAULT;
Now put this same thing inside a CTE and observe that the LSP does not complain
WITH asdf AS (
INSERT INTO foo.bar (
pk
) VALUES (
$1
) ON CONFLICT (pk) DO UPDATE SET
date_deleted = DEFAULT,
date_created = DEFAULT
) SELECT 1;
Expected behavior
Recognize valid syntax when using ON CONFLICT .. DO UPDATE
in any context
System information
- OS: macos
Additional context
- IDE: vscode w/ postgrestools extension
- used default/suggested config with the db section removed so that it's all LSP / not using db connection
Add any other context about the problem here.