gluesql / gluesql

GlueSQL is quite sticky. It attaches to anywhere.

Home Page:https://gluesql.org/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support INSERT ... ON DUPLICATE KEY UPDATE Statement

lcmgh opened this issue · comments

Is it possible to add support for INSERT ... ON DUPLICATE KEY UPDATE statements as described here: https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html

This would require support of primary keys which I have not found in the doc: https://gluesql.org/docs/0.14/sql-syntax/statements/data-definition/create-index

I think the fn insert should mention in its doc that it panics when the primary key already exists in the table.

DuplicateEntryOnPrimaryKeyField

This would require support of primary keys which I have not found in the doc: gluesql.org/docs/0.14/sql-syntax/statements/data-definition/create-index

Here are the docs for primary key support
https://gluesql.org/docs/0.14/sql-syntax/statements/data-definition/create-table#constraints

I think the fn insert should mention in its doc that it panics when the primary key already exists in the table.

Currently, we get a DuplicateEntryOnPrimaryKeyField error, but we don't panic internally - it's a user-handleable condition, so what's not documented is an improvement.

In my opinion, I would view this issue as a new feature request aimed at supporting ON DUPLICATE KEY UPDATE as the title suggests.

How about open a new issue for documentation improvements?