Re: BUG #16871: Insert with wrong key field, causing later crash of DB.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: david(at)littleriver(dot)ca
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16871: Insert with wrong key field, causing later crash of DB.
Date: 2021-02-17 16:02:04
Message-ID: 2537460.1613577724@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Euler Taveira 2021-02-17 16:54:03 Re: BUG #16868: Cannot find sqlstat error codes.
Previous Message Tom Lane 2021-02-17 15:46:29 Re: BUG #16870: ADD COLUMN IF NOT EXISTS with GENERATED ALWAYS AS IDENTITY can cause duplicate sequence