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

SQLITE: Foreign keys not respecting quote identifiers option #1577

Open
2 tasks
marinhio75 opened this issue Apr 17, 2024 · 0 comments
Open
2 tasks

SQLITE: Foreign keys not respecting quote identifiers option #1577

marinhio75 opened this issue Apr 17, 2024 · 0 comments

Comments

@marinhio75
Copy link

marinhio75 commented Apr 17, 2024

Hi, first of all thank you for pgloader ^^

pgloader version "3.6.7~devel"
compiled with SBCL 2.2.9.debian

inside of load-script:

load database
from sqlite:///path/db.hedgedoc.sqlite
into pgsql://user:pw@mydbsite/my_DB
WITH include drop, create tables, create indexes, reset sequences, quote identifiers, foreign keys, prefetch rows = 1000, batch rows = 1000, batch size = 1MB

set work_mem to '64MB', maintenance_work_mem to '512 MB';

After start: pgloader -v --root-dir=/root/pgloader/tmp load-script

NOTICE ALTER TABLE "Notes" ADD FOREIGN KEY(ownerId) REFERENCES "Users"(id) ON UPDATE NO ACTION ON DELETE CASCADE
2024-04-17T11:04:10.660052Z ERROR PostgreSQL Database error 42703: Spalte »ownerid«, die im Fremdschlüssel verwendet wird, existiert nicht
QUERY: ALTER TABLE "Notes" ADD FOREIGN KEY(ownerId) REFERENCES "Users"(id) ON UPDATE NO ACTION ON DELETE CASCADE
2024-04-17T11:04:10.660052Z NOTICE ALTER TABLE "Revisions" ADD FOREIGN KEY(noteId) REFERENCES "Notes"(id) ON UPDATE NO ACTION ON DELETE CASCADE
2024-04-17T11:04:10.660052Z ERROR PostgreSQL Database error 42703: Spalte »noteid«, die im Fremdschlüssel verwendet wird, existiert nicht
QUERY: ALTER TABLE "Revisions" ADD FOREIGN KEY(noteId) REFERENCES "Notes"(id) ON UPDATE NO ACTION ON DELETE CASCADE
2024-04-17T11:04:10.660052Z NOTICE ALTER TABLE "Authors" ADD FOREIGN KEY(userId) REFERENCES "Users"(id) ON UPDATE NO ACTION ON DELETE CASCADE
2024-04-17T11:04:10.660052Z ERROR PostgreSQL Database error 42703: Spalte »userid«, die im Fremdschlüssel verwendet wird, existiert nicht
QUERY: ALTER TABLE "Authors" ADD FOREIGN KEY(userId) REFERENCES "Users"(id) ON UPDATE NO ACTION ON DELETE CASCADE
2024-04-17T11:04:10.660052Z NOTICE ALTER TABLE "Authors" ADD FOREIGN KEY(noteId) REFERENCES "Notes"(id) ON UPDATE NO ACTION ON DELETE CASCADE
2024-04-17T11:04:10.664052Z ERROR PostgreSQL Database error 42703: Spalte »noteid«, die im Fremdschlüssel verwendet wird, existiert nicht
QUERY: ALTER TABLE "Authors" ADD FOREIGN KEY(noteId) REFERENCES "Notes"(id) ON UPDATE NO ACTION ON DELETE CASCADE
2024-04-17T11:04:10.668052Z LOG report summary reset
table name errors read imported bytes total time read write


 "Create Foreign Keys"          4          4          0                     0.008s

  Total import time          ✓     110446     110446   647.2 MB         16.464s
  • did you search for other similar issues?
    YES, already some days ;-)

  • how can I reproduce the bug?
    Good question, hopefully the description is enough to understand, wondering that no one else got a problem

p.e. with quote identifiers i get errors
ALTER TABLE "Notes" ADD FOREIGN KEY(ownerId) REFERENCES "Users"(id) ON UPDATE NO ACTION ON DELETE CASCADE
get error Column "ownerid" used in foreign key does not exist

same in
ALTER TABLE "Authors" ADD FOREIGN KEY(noteId) REFERENCES "Notes"(id) ON UPDATE NO ACTION ON DELETE CASCADE
get error Column "noteid" used in foreign key does not exist

in SQLITE DB foreign key are (nodeId) or (ownerId)

Thank you for every hint

Cheers Marinhio

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

No branches or pull requests

1 participant