BUG #16474: Foreign key issue

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #16474: Foreign key issue
Дата
Msg-id 16474-03a567470736cd26@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #16474: Foreign key issue  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #16474: Foreign key issue  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-bugs
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


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgbench bug / limitation
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #16472: Bug in to_timestamp ?