Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DELETE JOINs #3770

Closed
druvv opened this issue Jul 7, 2022 · 7 comments
Closed

Support DELETE JOINs #3770

druvv opened this issue Jul 7, 2022 · 7 comments
Assignees
Labels
enhancement New feature or request sql Issue with SQL

Comments

@druvv
Copy link
Contributor

druvv commented Jul 7, 2022

CREATE TABLE t (col1 int);

DELETE t
FROM t
JOIN dolt_conflicts_t c ON t.col1 = c.their_col1;
@druvv druvv added bug Something isn't working sql Issue with SQL labels Jul 7, 2022
@VinaiRachakonda
Copy link
Contributor

cc: #2134

@timsehn timsehn added enhancement New feature or request and removed bug Something isn't working labels Aug 30, 2022
@timsehn timsehn changed the title Delete joins throw table doesn't support DELETE FROM Support DELETE JOINs Aug 30, 2022
@zachmu
Copy link
Member

zachmu commented Feb 11, 2023

Root cause is #2134

@zachmu zachmu closed this as completed Feb 11, 2023
@timsehn
Copy link
Sponsor Contributor

timsehn commented Feb 17, 2023

This needs a better repro. We also don't support delete joins on tables with primary keys.

@timsehn timsehn reopened this Feb 17, 2023
@timsehn
Copy link
Sponsor Contributor

timsehn commented Feb 17, 2023

$ dolt init
Successfully initialized dolt data repository.
$ dolt sql -q "create table t1 (pk int, c1 int, primary key(pk)); create table t2 (pk int primary key)"
$ dolt ls 
Tables in working set:
     t1
     t2

$ dolt sql -q "insert into t1 values (0,0), (1,1); insert into t2 values (1);"
Query OK, 2 rows affected (0.00 sec)
Query OK, 1 row affected (0.00 sec)
$ dolt sql -q "delete from t1 join t2 on t1.pk=t2.pk"
Error parsing SQL
syntax error at position 20 near 'join'
delete from t1 join t2 on t1.pk=t2.pk
                    ^
syntax error at position 20 near 'join'

Should just delete (1, 1) in t1

@max-hoffman
Copy link
Contributor

> create table xy (x int primary key, y int);
> delete a  from xy a join xy b on a.x = b.x;
table doesn't support DELETE FROM

@timsehn
Copy link
Sponsor Contributor

timsehn commented Feb 17, 2023

This spill the right error:

$ dolt sql -q "delete t1 from t1 join t2 on t1.pk=t2.pk"
error on line 1 for query delete t1 from t1 join t2 on t1.pk=t2.pk: table doesn't support DELETE FROM
table doesn't support DELETE FROM

@fulghum fulghum self-assigned this Feb 18, 2023
@fulghum
Copy link
Contributor

fulghum commented Mar 2, 2023

DELETE JOIN support was released yesterday in dolt version 0.54.1

@fulghum fulghum closed this as completed Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sql Issue with SQL
Projects
None yet
Development

No branches or pull requests

6 participants