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

[Sqlite3] Fixed. panic: interface conversion when foreign key to column is nil #211

Merged
merged 1 commit into from
Mar 19, 2023

Conversation

sue445
Copy link
Owner

@sue445 sue445 commented Mar 19, 2023

Schema causing the error

ref. #210

sqlite> .schema album_genres
CREATE TABLE album_genres
(
	album_id varchar default null not null
		references album
			on delete cascade,
	genre_id varchar default null not null
		references genre
			on delete cascade,
	constraint album_genre_ux
		unique (album_id, genre_id)
);

sqlite> PRAGMA foreign_key_list(album_genres) ;
       id = 0
      seq = 0
    table = genre
     from = genre_id
       to =
on_update = NO ACTION
on_delete = CASCADE
    match = NONE

       id = 1
      seq = 0
    table = album
     from = album_id
       to =
on_update = NO ACTION
on_delete = CASCADE
    match = NONE

Close #210

```
sqlite> .schema album_genres
CREATE TABLE album_genres
(
	album_id varchar default null not null
		references album
			on delete cascade,
	genre_id varchar default null not null
		references genre
			on delete cascade,
	constraint album_genre_ux
		unique (album_id, genre_id)
);

sqlite> PRAGMA foreign_key_list(album_genres) ;
       id = 0
      seq = 0
    table = genre
     from = genre_id
       to =
on_update = NO ACTION
on_delete = CASCADE
    match = NONE

       id = 1
      seq = 0
    table = album
     from = album_id
       to =
on_update = NO ACTION
on_delete = CASCADE
    match = NONE
```

Close #210
@sue445 sue445 force-pushed the fix_sqlite3_panic branch from 0522342 to 6c0da0b Compare March 19, 2023 16:59
@sue445 sue445 marked this pull request as ready for review March 19, 2023 17:05
@sue445 sue445 merged commit 4d503a1 into master Mar 19, 2023
@sue445 sue445 deleted the fix_sqlite3_panic branch March 19, 2023 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQLite3: panic: interface conversion: interface {} is nil, not string
1 participant