pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: d.a.ignatyev@yandex.ru
Subject: BUG #16474: Foreign key issue
Date: Mon, 01 Jun 2020 16:17:28 +0000
Message-ID: <16474-03a567470736cd26@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      16474
Logged by:          Dmitry Ignatyev
Email address:      d.a.ignatyev@yandex.ru
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



view thread (4+ messages)  latest in thread

Message-ID: <16474-03a567470736cd26@postgresql.org>
Permalink:  ../16474-03a567470736cd26@postgresql.org/
Also on:    postgresql.org/message-id/16474-03a567470736cd26@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, d.a.ignatyev@yandex.ru
  Subject: Re: BUG #16474: Foreign key issue
  In-Reply-To: <16474-03a567470736cd26@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox