pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Burke <michael@engtech.ca>
To: Lane Van Ingen <lvaningen@esncc.com>
Cc: PGSQL-SQL <pgsql-sql@postgresql.org>
Subject: Re: Database with "override" tables
Date: Wed, 07 Dec 2005 10:11:03 -0400
Message-ID: <4396ED77.5000608@engtech.ca> (raw)
In-Reply-To: <EKEMKEFLOMKDDLIALABIEENGCFAA.lvaningen@esncc.com>
References: <EKEMKEFLOMKDDLIALABIEENGCFAA.lvaningen@esncc.com>

Lane Van Ingen wrote:

>Not quite sure how to answer this, but one thought does occur to me: I was
>perhaps assuming that an override table would override an entire record in
>the 'original' table(that is what we are doing), and we require that
>critical fields in the override field be NOT NULL (and in some cases,
>provide DEFAULT values). Will that help?
>  
>
I fought with the UNION method for a while before backing off to my 
extremely-long-query system with a FULL JOIN:


SELECT COALESCE(ot.desc, it.desc) FROM initial_table it FULL JOIN 
override_table ot ON it.initial_id = ot.initial_id;


It's not so bad until you get to cross-reference other tables that have 
override tables, but then it just becomes pretty ugly.  So I'll stick 
with that for now.

If the override table did indeed override entire records in the original 
table, the UNION would have worked beautifully and probably made things 
cleaner.  Thanks for the advice.

Mike.



view thread (5+ messages)

Message-ID: <4396ED77.5000608@engtech.ca>
Permalink:  ../4396ED77.5000608@engtech.ca/
Also on:    postgresql.org/message-id/4396ED77.5000608@engtech.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: michael@engtech.ca, lvaningen@esncc.com
  Subject: Re: Database with "override" tables
  In-Reply-To: <4396ED77.5000608@engtech.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox