Foreign Key Fails on Trigger
I'm having an issue when I create a new user, I want to insert a row (using a trigger) into the
I get this error:
However, as seen in the snippet below, I believe I am passing this value in as
Is there a way I can log the value of
What I've tried: I tested the insert in isolation using hardcoded data, tested the function / trigger with mock examples. It just seems to be when I try to pass the
decks table, which has a foreign key constraint of user_id.I get this error:
insert or update on table "decks" violates foreign key constraint "decks_user_id_fkey"However, as seen in the snippet below, I believe I am passing this value in as
new.id to the field user_idIs there a way I can log the value of
new.id? Or am I doing something obviously incorrect here?What I've tried: I tested the insert in isolation using hardcoded data, tested the function / trigger with mock examples. It just seems to be when I try to pass the
new.id to real data with real constraints that it fails.