Обсуждение: Chained table entries

Поиск
Список
Период
Сортировка

Chained table entries

От
"Roderick A. Anderson"
Дата:
Or maybe some other thingy.

I have a table that I want to refer to one of it's own attributes.  I
thought of RI but there has to be a top level entry that shouldn't be in
the table.  Then I thought of a check constraint using a select with
UNION but that dies (probably because UNIONs in views aren't ready for
primetime yet).  So finally I figured a RULE would work but I've never
done one and am waiting on Bruce's book before trying.
   But I'm not above accepting suggestions - or code.

The table has a primary key attribute whos values could be used in another
column or have a VALUE of 'NEWthingy'.

If I could do the RI as a view the code would be

create view THINGYS
    as select tbl_key
  from maintable
 UNION select 'NEWthingy'
;

Will a Rule handle this?


TIA,
Rod
--
Roderick A. Anderson
raanders@altoplanos.net               Altoplanos Information Systems, Inc.
Voice: 208.765.6149                            212 S. 11th Street, Suite 5
FAX: 208.664.5299                                  Coeur d'Alene, ID 83814