Hi,

Thanks for the help! I will fix the source database which is of course the
better solution, but I did want to ask as pgloader does not seem to use
identifier quoting, so I was curious as to the practice of using it and
whether it was better to use double quotes over no quotes.


Thanks,
Anant

On Fri, Aug 14, 2020 at 6:10 PM Jeremy Evans <[email protected]> wrote:

> On Friday, August 14, 2020 at 3:03:19 PM UTC-7, Anant M wrote:
>>
>> Thanks! Ran it with -E and here's where it failed:
>>
>>>
>>> I, [2020-08-14T16:48:19.596261 #64101]  INFO -- : (0.004751s) ALTER
>>> TABLE "BxMSOptions" ADD FOREIGN KEY ("courseID") REFERENCES
>>> "Courses"("courseID")
>>> E, [2020-08-14T16:48:19.597539 #64101] ERROR -- : PG::UndefinedTable:
>>> ERROR:  relation "courses" does not exist: ALTER TABLE
>>> "CoursesUGDesignations" ADD FOREIGN KEY ("courseID") REFERENCES
>>> "courses"("courseID"), ADD FOREIGN KEY ("designation") REFERENCES
>>> "UGDesignations"("designation")
>>>
>>
>> This was a new table that was added that created the new error. However,
>> other tables do have foreign keys that link to Courses/courseID so I'm
>> unsure why it is breaking now, where the other dump has the following:
>>
>> I, [2020-08-14T16:57:34.177727 #65461]  INFO -- : (0.006945s) ALTER TABLE
>>> "BxMSOptions" ADD FOREIGN KEY ("courseID") REFERENCES "Courses"("courseID")
>>> I, [2020-08-14T16:57:34.179610 #65461]  INFO -- : (0.001656s) ALTER
>>> TABLE "CrossListings" ADD FOREIGN KEY ("courseID") REFERENCES
>>> "Courses"("courseID")
>>>
>>
>> I guess it seems like the new foreign key was created to reference
>> lowercase courses. Is there a way to not wrap table names in double quotes
>> while copying?
>>
>
> Something like that should be really fixed in the source database.
>
> To disable quoting when using the -C option, you could add a file named
> disable_quoting.rb to the current directory with the following content:
>
> DB.extension :identifier_mangling
> DB.quote_identifiers = false
> Sequel::Database.after_initialize do |db|
>   db.extension :identifier_mangling
>   db.quote_identifiers = false
> end
>
>
> Then you could run the copy loading that file:
>
> bin/sequel -C -E -r ./disable_quoting.rb sqlite://... postgres://...
>
> I have no idea if that will result in a working database or not.
> Disabling identifier quoting can result in all manner of issues.  I highly
> recommend you fix the source SQLite database before attempting to migrate
> SQLite to PostgreSQL, instead of trying to disable identifier quoting.
>
> Thanks,
> Jeremy
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sequel-talk" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sequel-talk/NgD2igk8ks0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sequel-talk/ad61319d-a664-406f-b74e-f11024c5ef8co%40googlegroups.com
> <https://groups.google.com/d/msgid/sequel-talk/ad61319d-a664-406f-b74e-f11024c5ef8co%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CAPLYRqqtebj_8Y_C02RSt%2BK-QkJiLJeKgK5grXRp8uzg_cJaxA%40mail.gmail.com.

Reply via email to