vitessio / website

vitess.io website and other project management related content
https://vitess.io
Apache License 2.0
47 stars 187 forks source link

Inaccuracy on Foreign Key page #1714

Closed bddicken closed 3 months ago

bddicken commented 3 months ago

This page states:

Some query syntaxes like REPLACE INTO and INSERT INTO ... ON DUPLICATE KEY UPDATE aren't supported.

From what I can tell, INSERT INTO ... ON DUPLICATE KEY UPDATE works ok with Vitess. I tested via PS. Is there a difference between whats supported on PS vs vanilla Vitess?

However, using INSERT... AS ... is not supported, but this is even for DBs without fk constraints.

harshit-gangal commented 3 months ago

In FK when the column getting updated in on duplicate key upddate is a foreign key column. It will be rejected. We have added some partial support like table having only 1 unique column so it not fully supported yet.

Insert .. As support is a general support that needs to be added. That is unrelated to FK.

bddicken commented 3 months ago

I guess the documentation isn't very clear about this. From what it says on that page, someone might be led to believe that the ON DUPLICATE KEY UPDATE is not supported at ALL if FK constraints are enabled for a keyspace. Rather, sounds like what you are saying is that it will only fail if the column is an FK constraint column. Maybe not a huge deal, but may be useful to clarify that wording on the site.

harshit-gangal commented 3 months ago

We will update the doc once we have a good story for OSS Vitess i.e. when we have shard-scoped or cross-shard support