Subject | Re: [firebird-support] Foreign key Forensics |
---|---|
Author | Helen Borrie |
Post date | 2004-05-11T06:29:53Z |
At 02:58 PM 11/05/2004 +1000, you wrote:
RDB$REF_CONSTRAINTS - has the names of the foreign key constraints and the
corresponding unique constraints that they reference
RDB$RELATION_CONSTRAINTS shows the constraint names for all the tables (RI
and other constraints) along with the index names
RDB$INDEX_SEGMENTS shows you the makeup of all the indexes, including those
used to enforce constraints.
If you want a forensic tool, get hold of IB_SQL (free from
www.ibobjects.com). Its browser does all the forensics for you; or, if you
prefer to do your own tracking, click on System Inf. in the Relations tab
and you can view the RDB$ data directly.
/heLen
>I've been having trouble getting foreign key info out of the system tables.Get in amongst the following tables:
>
>To describe what I'm after, here is a simple schema
>
>CREATE TABLE tbl_farside (
> str_text VARCHAR(100) NOT NULL,
> PRIMARY KEY(str_text)
>);
>
>CREATE TABLE tbl_nearside (
> int_id INTEGER NOT NULL,
> str_text VARCHAR(100),
> PRIMARY KEY(int_id),
> FOREIGN KEY(str_text) REFERENCES tbl_farside ON UPDATE CASCADE
>);
>
>ok. Using the rdb$ tables, I need to find out that 'tbl_farside.str_text' is
>used as a foreign key constraint by my 'nearside' table.
>Imagine that tbl_farside is not known - all I know is the nearside table...
>All the examples I've found around the place will give me
>tbl_nearside.str_text, but not the remote(farside) end.
>
>Hopefully this question is suitably crafted.
RDB$REF_CONSTRAINTS - has the names of the foreign key constraints and the
corresponding unique constraints that they reference
RDB$RELATION_CONSTRAINTS shows the constraint names for all the tables (RI
and other constraints) along with the index names
RDB$INDEX_SEGMENTS shows you the makeup of all the indexes, including those
used to enforce constraints.
If you want a forensic tool, get hold of IB_SQL (free from
www.ibobjects.com). Its browser does all the forensics for you; or, if you
prefer to do your own tracking, click on System Inf. in the Relations tab
and you can view the RDB$ data directly.
/heLen