PG Bug reporting form <noreply@postgresql.org> writes:
> This has happened three times to me over the last few months. Database
> crashes later on insert with faulty char[32] key field, matthew vs proper
> key of matt.
> 2021-02-17 00:25:29 AST ERROR: insert or update on table "employee_shift"
> violates foreign key constraint "employee_shift_userid_fkey"
> 2021-02-17 00:25:29 AST DETAIL: Key (userid)=(matthew
> ) is not present in table "users".
> 2021-02-17 00:25:29 AST STATEMENT: INSERT INTO batch.employee_shift
> (userid, date, shift,milking_number) VALUES ('matthew', '2019-09-14',
> 'am',1);
> 2021-02-17 06:23:09 AST LOG: received fast shutdown request
> 2021-02-17 06:23:09 AST LOG: aborting any active transactions
Well, that's not a crash; that's a commanded shutdown. (The *only*
way to get that message is for something to send the postmaster a
SIGINT signal.) It's fairly hard to credit that there's any direct
connection to a simple SQL error six hours earlier, either.
I'm going to venture out on a limb here, but I'd suggest reviewing
exactly how you're starting Postgres. If you're launching it from
a manual shell command, and you're not being careful to fully dissociate
it from the shell's terminal, then you can get results like this when
you later type control-C, log out from that session, etc.
regards, tom lane