-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Skip foreign keys on TEXT/BLOB fields + use Primary key when not defined in REFERENCES #75
Comments
Good spot. Can you supply me an example database to test against? |
Looks like the problem is in the setup of your foreign keys as they don't seem to point to anything. If you query for the foreign_key_list PRAGMA foreign_key_list("attendance"); You'll get
The
Do your foreign keys in SQLite even work properly? |
in dbeaver, i can see foreign key references to a column. Can you try to use some IDE and check if there is actually an issue with foreign key |
I have used DBeaver do inspect it, however, that doesn't help me much in terms of the script which uses PRAGMA foreign_key_list("attendance"); to get the keys programatically. I'm not aware of a different method. Could you maybe try and make your foreign key definitions more specific so that they have both |
It looks like this is shorthand form foreign key that indirectly references the primary key of the linking table as is described here:
The CREATE TABLE "attendance"
(
link_to_event TEXT
constraint attendance_event_event_id_fk
references event,
link_to_member TEXT
constraint attendance_member_member_id_fk
references member,
constraint attendance_pk
primary key (link_to_event, link_to_member)
); |
Hmm, getting to the bottom of this. Looks like you can't have foreign keys on TEXT / BLOB.
|
Describe the bug
MySQL failed adding foreign key to attendance.link_to_member referencing member.None: 1170 (42000): BLOB/TEXT column 'link_to_member' used in key specification without a key length
Traceback (most recent call last)
System Information
For fields which are of type text in sqlite3 and are foreign keys, it should automatically assign some length to key
The text was updated successfully, but these errors were encountered: