logo       

Re: Inheritence and Integrity: msg#00491

Subject: Re: Inheritence and Integrity
> inheriting pk and triggers

pg inheritance is quite limited.  what i (and i'm sure many others)
have done is:

1. create master sequence
2. create base table
3. create base trigger procedures
4. create derived tables, using "inherit"
5. write procedure p( table_name ) that
 a) sets pk of table_name using master sequence
 b) attaches base trigger procedures onto table_name
6. run procedure p() against each derived table


another way to skin this cat is to use "objects" in the database:

-- base table
table common(
  int id primary key ...,
  ref_tab name,  -- name of secondary table using common
  ...            -- common columns and constraints
) without oids;

-- secondary table
table secondary1(
  int id1 not null references common(id),
  int id2 primary key,  -- (can use id1 as pk!)
  ...                   -- secondary columns and constraints
) without oids;

-- views for secondary table - generate!
create secondary1_v1 as select c.*, s.*
from secondary1 s join common c on( s.id1 = c.id );

-- (if you want) dml for view to make life easier - generate!
...

if you are maintaining the common info, or if you want a many to one
secondary to master, this approach is easier.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
message can get through to the mailing list cleanly



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe