Skip to content

Does not support shorthand form to create the foreign key constraint #5941

Closed
@gekkone

Description

@gekkone

Bug Report

Q A
Version 3.6.0

Summary

Sqlite (3.41.0) Does not define the foreign column name when using shorthand form to create the foreign key constraint.
Sample:

CREATE TABLE artist(
  artistid    INTEGER PRIMARY KEY, 
  artistname  TEXT
);
CREATE TABLE track(
  trackid     INTEGER,
  trackname   TEXT, 
  trackartist INTEGER REFERENCES artist
);

Current behaviour

SqliteSchemaManager::listTableForeignKeys return ForeignKeyConstraint with empty foreignColumnNames

How to reproduce

Probably the problem is that PRAGMA foreign_key_list returns null in the "to" column
Sample:

sqlite> PRAGMA FOREIGN_KEY_LIST('track');
id          seq         table         from            to          on_update   on_delete   match
----------  ----------  ------------  --------------  ----------  ----------  ----------  ----------
0           0             artist         trackartist   -NULL-      NO ACTION   NO ACTION   NONE

Expected behaviour

SqliteSchemaManager::listTableForeignKeys return ForeignKeyConstraint with the primary key column of references table in a foreignColumnNames

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions