PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16474
PG Version12.2
OSWindows 10
Opened2020-06-01 16:17:28+00
Reported byDmitry Ignatyev
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16474
Logged by:          Dmitry Ignatyev
Email address:      (redacted)
PostgreSQL version: 12.2
Operating system:   Windows 10
Description:        

Hey, guys,

A few lines of SQL to clarify the situation:

        /* Here we make sure there is a value in parent table */

	select source from shelf.r_source where source = 'PPDM39RNEX' \gset

       /* And here we try to use it in an insert */

	INSERT INTO ppdm.ppdm_rule_remark
		(rule_id, 
		remark_type, 
		remark_seq_no, 
		remark_date, 
		"source")
	VALUES
		(:'ppdm_rule_id',
		:'remark_type',
		nextval('shelf.id_sequence'),
		NOW(),
		:'source');

This kind of code produces an SQLSTATE 23503

START TRANSACTION
psql:rule_run.sql:43: ОШИБКА:  INSERT или UPDATE в таблице
"ppdm_rule_remark" нарушает ограничение внешнего ключа "prr_r_s_fk"
ПОДРОБНОСТИ:  Ключ (source)=(PPDM39RNEX) отсутствует в таблице "r_source".
ROLLBACK

This is a foreign key violation message in Russian reporting an absence of
an existing value PPDM39RNEX.

Any quick workaround?

Best regards, Dmitry

Messages

DateAuthorSubject
2020-06-01 16:17:28+00PG Bug reporting formBUG #16474: Foreign key issue
2020-06-01 17:05:24+00Tom LaneRe: BUG #16474: Foreign key issue
2020-06-01 19:36:11+00RE: BUG #16474: Foreign key issue
2020-06-01 19:52:26+00Alvaro HerreraRe: BUG #16474: Foreign key issue