tursodatabase / tursodatabase/libsql
Unable to add or modify foreign key
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 17.2k
- Forks
- 531
- Avg merge
- 1h 12m
- Merged PRs (30d)
- 1
Description
I am facing the same issue as mentioned here. But this time it is not ALTER TABLE which gives the error. It is FOREIGN KEY that gives the error.
Reproduction: (in any new database)
First create the tables:
CREATE TABLE users (id INT PRIMARY KEY);
CREATE TABLE emails (id INT PRIMARY KEY);
Then run
ALTER TABLE emails ADD FOREIGN KEY (users_id) REFERENCES users(id);
which fails and gives the error SQL string could not be parsed: near FOREIGN, "None": syntax error at (1, 31)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the SQL statements in a new database and compare the failure with linked issue 447. Trace how ALTER TABLE parses the FOREIGN KEY clause and verify that the completed change accepts the statement and creates the intended reference from emails(users_id) to users(id).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100