RI Constraint display

From: elein <elein(at)sbcglobal(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: elein(at)varlena(dot)com
Subject: RI Constraint display
Date: 2002-12-26 21:09:32
Message-ID: 200212262111.gBQLBKMm122762@pimout1-ext.prodigy.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)varlena(dot)com Database Consulting www.varlena.com
I have always depended on the [QA] of strangers.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-12-26 21:45:00 Re: RI Constraint display
Previous Message Joe Lester 2002-12-26 18:28:31 Moving from 4D to Postgres