-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
Description
Description
Add support for PostgreSQL's INSERT ... ON CONFLICT (upsert) syntax.
Example SQL
-- ON CONFLICT DO NOTHING
INSERT INTO users (id, name) VALUES (1, 'John')
ON CONFLICT (id) DO NOTHING;
-- ON CONFLICT DO UPDATE
INSERT INTO users (id, name, email) VALUES (1, 'John', '[email protected]')
ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name, email = EXCLUDED.email;
-- With WHERE clause
INSERT INTO products (sku, price) VALUES ('ABC', 100)
ON CONFLICT (sku) DO UPDATE SET price = EXCLUDED.price
WHERE products.price < EXCLUDED.price;
-- ON CONFLICT ON CONSTRAINT
INSERT INTO users (id, name) VALUES (1, 'John')
ON CONFLICT ON CONSTRAINT users_pkey DO NOTHING;Current Behavior
INSERT with ON CONFLICT is not supported.
Expected Behavior
Parser should recognize ON CONFLICT clause with DO NOTHING or DO UPDATE actions.
Priority
High - commonly used PostgreSQL pattern for upserts
Implementation Notes
- Add
OnConflictClauseAST node - Support conflict target (columns or constraint name)
- Support DO NOTHING and DO UPDATE SET actions
- Handle EXCLUDED pseudo-table references