pgloader icon indicating copy to clipboard operation
pgloader copied to clipboard

SQLITE: Foreign keys not respecting quote identifiers option

Open marinhio75 opened this issue 1 year ago • 0 comments

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

marinhio75 avatar Apr 17 '24 12:04 marinhio75

Well, i don't really know what type of encoder are you using, but with help of some code from internet (obviously credited correctly in the head of the sketch) and a library from Paul Stoffregen, i was able to use a quadrature encoder from a printer's paper feed mechanism, and one incremental encoder of the following model: LPD3806-600BM-G5-24C

Just need to rename the extension to .ino to open in the IDE, install the library using the built-in manager (need to be the correct encoder library from the guy i said), and the signal wires from the encoder goes to pins D2 and D3 And don't forget to tell me if it worked for you, crediting as well

MegaJoyEncoderFinalMod.txt

MineAngerBR avatar Sep 25 '20 15:09 MineAngerBR

Thanks for answering me! Your code worked. But I want to activate two digital buttons when turning the encoder. Example: Rotate left: Activate D2 Rotate right: Activate D3.

But when I turn it into MegaJoy, only slow spins work. If I try to rotate quickly, the buttons do not activate accurately.

My encoder: KY-040

Example in video:

Em sex., 25 de set. de 2020 às 12:37, MineAngerBR [email protected] escreveu:

Well, i don't really know what type of encoder are you using, but with help of some code from internet (obviously credited correctly in the head of the sketch) and a library from Paul Stoffregen, i was able to use a quadrature encoder from a printer's paper feed mechanism, and one incremental encoder of the following model: LPD3806-600BM-G5-24C

Just need to rename the extension to .ino to open in the IDE, install the library using the built-in manager (need to be the correct encoder library from the guy i said), and the signal wires from the encoder goes to pins D2 and D3 And don't forget to tell me if it worked for you, crediting as well

MegaJoyEncoderFinalMod.txt https://github.com/AlanChatham/UnoJoy/files/5283742/MegaJoyEncoderFinalMod.txt

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AlanChatham/UnoJoy/issues/36#issuecomment-698999951, or unsubscribe https://github.com/notifications/unsubscribe-auth/AREF7M7YXVFDL4QS6VCYXDDSHS2MVANCNFSM4RYZISPQ .

hirakkopk avatar Sep 25 '20 16:09 hirakkopk

With your code I can adjust it to work for me. However, when i turn the encoder very fast, megajoy does not process data. It only works if you turn it slowly.

Setting "volatile int serialCheckInterval = 1" to "0" in MegaJoy.h helped to decrease the delay. but there is still a little bit.

Do you know how to solve this?

hirakkopk avatar Sep 25 '20 18:09 hirakkopk

Video example , rename to .mp4 encodervideo.txt

hirakkopk avatar Sep 25 '20 18:09 hirakkopk

Unfortunately i won't know how to solve it. Maybe it is related to the serial frequency, because if i'm not mistaken in the documentation inside MegaJoy.h, line 149, saying: "Start the serial port at the specific, low-error rate UnoJoy uses. If you want to change the rate, you'll have to change it in the firmware for the ATmega8u2 as well. 250,000 is actually the best rate, but it's not supported on Macs, breaking the processing debugger."

If you know how to compile the firmware for the ATmega16U2, trying a higher frequency won't hurt anything.

MineAngerBR avatar Sep 25 '20 18:09 MineAngerBR

I am trying to make something similar to you, but instead of pressing keys with an encoder, using two axis to map the position of an h-shifter pattern and press that button, but i'm also hitting this delay, and since i'm not that specialist with programming, i don't know how to compile it to try a higher frequency for the serial comm.

MineAngerBR avatar Sep 25 '20 18:09 MineAngerBR

I'm actually quite an amateur in that. But I will try to modify it. I'll let you know if I can.

hirakkopk avatar Sep 25 '20 19:09 hirakkopk

Man, managed to change the values ​​in the firmware and it works better. Tell me which version of UnoJoy you use. Uno / Leo / Mega.

I will send you the modified firmware.

hirakkopk avatar Sep 25 '20 23:09 hirakkopk

Hi! I'm guessing that there might be an issue with interrupts - a guess might be that the encoder's use of interrupts is being blocked or delayed by MegaJoy's use of interrupts. Looks like that encoder library has an option for working without interrupts, though - try adding the following line at the top of your code, BEFORE the includes, which should switch the encoder library to not use interrupts:

#define ENCODER_DO_NOT_USE_INTERRUPTS 1

Just a shot in the dark, but I hope it helps!

AlanChatham avatar Sep 26 '20 00:09 AlanChatham

Man, managed to change the values ​​in the firmware and it works better. Tell me which version of UnoJoy you use. Uno / Leo / Mega.

I will send you the modified firmware.

I use the Mega, but want to use Uno in the future

And please confirm what serial frequency you chose in thw firmware

MineAngerBR avatar Sep 26 '20 00:09 MineAngerBR

Hello AlanChatham! I tried to use your command but it hasn't changed much. The virtual control does not follow the movements of the encoder. Only when I turn slowly.

MineAnger, I changed the serial to 250000. I see if it improves more than that.

hirakkopk avatar Sep 26 '20 00:09 hirakkopk

Hello AlanChatham! I tried to use your command but it hasn't changed much. The virtual control does not follow the movements of the encoder. Only when I turn slowly.

MineAnger, I changed the serial to 250000. I see if it improves more than that.

Okay, i'm waiting for you to send me the Mega and Uno firmware please, so i can test here

MineAngerBR avatar Sep 26 '20 17:09 MineAngerBR

Copy and paste into Uno / MegaJoy folders. And tell me if it worked. Don't forget to change Serial.begin to 250000 in UnoJoy.h / MegaJoy.h

Raname for .rar UnoJoySerialRateUpdate.txt

hirakkopk avatar Sep 26 '20 17:09 hirakkopk

I know this is really kind of the opposite of a solution, but if you don't have any luck with any of this, one way to get around this would be to use a separate Arduino to read the encoder, and you could just send that information to the MegaJoy via the analog pins. Not ideal, clearly, but definitely a way that would work?

AlanChatham avatar Sep 26 '20 18:09 AlanChatham

Maybe someone could try this. I only have 1 Mega and I can't buy another one. Where I live is very expensive. Thank you anyway

hirakkopk avatar Sep 26 '20 20:09 hirakkopk

I know that this discussion is a bit old, but if that may help someone. My encoders were unusable with Unojoy (UNO). I tried the SerialRateUpdate trick bit it didn't help.

I found a solution by inserting a delay of 20 ms after the encoder reading (I use encoder.h lib)

(Sorry I don't know how to insert code in here)

long NewEncB = EncB.read(); if (NewEncB != PosEncB ) { if (NewEncB > PosEncB ) { Hor[3] = 1; } else { Hor[2] = 1; } PosEncB = NewEncB; } long NewEncC = EncC.read(); if (NewEncC != PosEncC ) { if (NewEncC > PosEncC ) { Hor[5] = 1; } else { Hor[4] = 1; } PosEncC = NewEncC; } delay(20); dataForController_t controllerData = getBlankDataForController();

ouiouiblog avatar Jun 16 '21 16:06 ouiouiblog