Issue #44 resolved

getExportedKeys throws Null Exception for foreign key without explicit primary column name

Anonymous created an issue

I have a schema like:

create table REFERRED(ID integer primary key not null); create table REFERRING(ID integer, RID integer, foreign key (RID) references REFERRED2 );

On schema loading I get: REFERRED java.lang.NullPointerException at org.sqlite.MetaData.escape(MetaData.java:1862) at org.sqlite.MetaData.getExportedKeys(MetaData.java:1504)

I've tried 3.7.2 and the latest 3.7.15 builds.

Comments (9)

  1. Greg Shrago

    Please reopen as the error occurs regardless of my typo in the description of the ticket.

    The problem is in org.sqlite.MetaData.getExportedKeys which tries to escape NULL key name.

    Here you go. No typo this time:

    create table REFERRED (ID integer primary key not null);

    create table REFERRING (ID integer, RID integer, foreign key (RID) references REFERRED);

  2. Grace Batumbya

    Narrowed down the cause of the NullPointerException to foreign_key_list('referring') returning null for the primary key column.

    Should have issue solved soon.

  3. Log in to comment