lovasoa opened a new issue, #2010:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/2010
The following query works in PostgreSQL but returns a parse error in
sqlparser:
```sql
WITH merged_row AS (
MERGE INTO users AS cible
USING (
SELECT
'john.doe' AS username,
'password' AS password,
'xxxxxxxxxx' AS uuid,
TRUE as is_active
) AS source
ON cible.uuid = source.uuid
WHEN MATCHED THEN
UPDATE SET
username = source.username,
password = source.password,
uuid = source.uuid,
is_active = source.is_active
WHEN NOT MATCHED THEN
INSERT (username, password, uuid, is_active)
VALUES (source.username, source.password, source.uuid,
source.is_active)
RETURNING *
)
SELECT
'debug' AS component,
COUNT(*) AS count
FROM merged_row;
```
The postgres documentation says:
> Each auxiliary statement in a WITH clause can be a SELECT, INSERT, UPDATE,
DELETE, **or MERGE**;
>
> -- https://www.postgresql.org/docs/current/queries-with.html
Initially reported in https://github.com/sqlpage/SQLPage/issues/995
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]