RI Constraint display

Поиск
Список
Период
Сортировка
От elein
Тема RI Constraint display
Дата
Msg-id 200212262111.gBQLBKMm122762@pimout1-ext.prodigy.net
обсуждение исходный текст
Ответы Re: RI Constraint display  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Referential integrity constraints are displayed as $n.
Is this a bug or a feature?  I first ran into the issue
with the RI error message and I thought it was just a message
bug.  But I can also see the $n as a name with \d via psql.
Looking at pg_trigger, though, makes me think that there
might be some confusion between tgname and tgconstrname
(what is tgconstrname??) and tgargs.

Or is this how it is supposed to be?  I really expected the
trigger name to be displayed where it is displaying $1 and $2
in the error message and in psql.

postgresql 7.3.1
SuSe 7.3

--elein



create table rr_reports (
        r_name          text not null,
        rt_type         text not null,
        ag_name         text,
        r_title         text,
        r_sdesc         text,
        r_ldesc         text,
        PRIMARY KEY (r_name)
        , FOREIGN KEY (rt_type) references rr_types
        , FOREIGN KEY (ag_name) references rr_appgroups
);

From log after bad INSERTS:

ERROR:  $2 referential integrity violation - key referenced from rr_reports
not found in rr_appgroups
ERROR:  $1 referential integrity violation - key referenced from rr_rprompts
not found in rr_reports

But I also see it using \d:
\d rr_reports
 Table "public.rr_reports"
 Column  | Type | Modifiers
---------+------+-----------
 r_name  | text | not null
 rt_type | text | not null
 ag_name | text |
 r_title | text |
 r_sdesc | text |
 r_ldesc | text |
Indexes: rr_reports_pkey primary key btree (r_name)
Foreign Key constraints: $1 FOREIGN KEY (rt_type) REFERENCES
rr_types(rt_type) ON UPDATE NO
ACTION ON DELETE NO ACTION,
                         $2 FOREIGN KEY (ag_name) REFERENCES
rr_appgroups(ag_name) ON UPDATE NO ACTION ON DELETE NO ACTION

select * from pg_trigger;
 tgrelid |           tgname            | tgfoid | tgtype | tgenabled |
tgisconstraint | tgconstrname | tgconstrrelid | tgdeferrable | tginitdeferred
| tgnargs | tgattr |
                   tgargs

---------+-----------------------------+--------+--------+-----------+----------------+--------------+---------------+--------------+----------------+---------+--------+---------------------------------------------------------------------------
  437264 | RI_ConstraintTrigger_437272 |   1644 |     21 | t         | t
        | $1
         |        437254 | f            | f              |       6 |        |
$1\000rr_reports\000rr_types\000UNSPECIFIED\000rt_type\000rt_type\000
  437254 | RI_ConstraintTrigger_437273 |   1654 |      9 | t         | t
        | $1
         |        437264 | f            | f              |       6 |        |
$1\000rr_reports\000rr_types\000UNSPECIFIED\000rt_type\000rt_type\000
  437254 | RI_ConstraintTrigger_437274 |   1655 |     17 | t         | t
        | $1
         |        437264 | f            | f              |       6 |        |
$1\000rr_reports\000rr_types\000UNSPECIFIED\000rt_type\000rt_type\000
  437264 | RI_ConstraintTrigger_437276 |   1644 |     21 | t         | t
        | $2
         |        437244 | f            | f              |       6 |        |
$2\000rr_reports\000rr_appgroups\000UNSPECIFIED\000ag_name\000ag_name\000
  437244 | RI_ConstraintTrigger_437277 |   1654 |      9 | t         | t
        | $2
         |        437264 | f            | f              |       6 |        |
$2\000rr_reports\000rr_appgroups\000UNSPECIFIED\000ag_name\000ag_name\000
  437244 | RI_ConstraintTrigger_437278 |   1655 |     17 | t         | t
        | $2
         |        437264 | f            | f              |       6 |        |
$2\000rr_reports\000rr_appgroups\000UNSPECIFIED\000ag_name\000ag_name\000

--
----------------------------------------------------------------------------------------
elein@varlena.com     Database Consulting     www.varlena.com
              I have always depended on the [QA] of strangers.

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

Предыдущее
От: Joe Lester
Дата:
Сообщение: Moving from 4D to Postgres
Следующее
От: Tom Lane
Дата:
Сообщение: Re: RI Constraint display