Skip to content

quote identifiers not applied to foreign key constraints from sqlite3 #1486

Open
@jinnatar

Description

@jinnatar
  • pgloader --version

    %> pgloader-bundle-3.6.9/bin/pgloader --version
    pgloader version "3.6.9"
    compiled with SBCL 2.1.1.debian
  • did you test a fresh compile from the source tree?

    %> build/bin/pgloader --version
    pgloader version "3.6.999791d"
    compiled with SBCL 2.1.1.debian
  • did you search for other similar issues?

  • how can I reproduce the bug?
    Dump from sqlite db.sqlite3:

PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE pages (id int PRIMARY KEY, authorId int, FOREIGN KEY(authorId) REFERENCES users("authorId"));
INSERT INTO pages VALUES(1,42);
CREATE TABLE users (id bigint PRIMARY KEY, name text NOT NULL, authorId int NOT NULL);
INSERT INTO users VALUES(1,'demo',42);
COMMIT;
  • pgloader output you obtain
%> PGPASSWORD=foobar build/bin/pgloader --with "quote identifiers" sqlite://db.sqlite3 pgsql://[email protected]/demo
2023-05-08T11:50:21.016000+03:00 LOG pgloader version "3.6.999791d"
2023-05-08T11:50:21.080002+03:00 LOG Migrating from #<SQLITE-CONNECTION sqlite:///vol/home/src/3rd-party-forks/pgloader/db.sqlite3 {10074EE4C3}>
2023-05-08T11:50:21.080002+03:00 LOG Migrating into #<PGSQL-CONNECTION pgsql://[email protected]/demo {1007644B63}>
2023-05-08T11:50:21.600015+03:00 ERROR PostgreSQL Database error 42703: column "authorid" referenced in foreign key constraint does not exist
QUERY: ALTER TABLE "pages" ADD FOREIGN KEY(authorId) REFERENCES "users"(authorId) ON UPDATE NO ACTION ON DELETE NO ACTION
2023-05-08T11:50:21.608015+03:00 LOG report summary reset
             table name     errors       rows      bytes      total time
-----------------------  ---------  ---------  ---------  --------------
                  fetch          0          0                     0.000s
        fetch meta data          0          5                     0.064s
         Create Schemas          0          0                     0.000s
       Create SQL Types          0          0                     0.008s
          Create tables          0          4                     0.028s
         Set Table OIDs          0          2                     0.008s
-----------------------  ---------  ---------  ---------  --------------
                "pages"          0          1     0.0 kB          0.060s
                "users"          0          1     0.0 kB          0.056s
-----------------------  ---------  ---------  ---------  --------------
COPY Threads Completion          0          4                     0.060s
 Index Build Completion          0          2                     0.136s
         Create Indexes          0          2                     0.028s
        Reset Sequences          0          0                     0.064s
           Primary Keys          0          0                     0.000s
    Create Foreign Keys          1          0                     0.004s
        Create Triggers          0          0                     0.000s
       Install Comments          0          0                     0.000s
-----------------------  ---------  ---------  ---------  --------------
      Total import time          ✓          2     0.0 kB          0.292s
  • data that is being loaded, if relevant
  • How the data is different from what you expected, if relevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions