On Tue, Dec 29, 2009 at 4:44 PM, Bryce Nesbitt <bry...@obviously.com> wrote:
> Craig is correct in the OP attempt. All but one field is intended to be null Ah; my misunderstanding, then. Sorry for the noise. > Duplicate rows, or data in multiple columns, would wreck havoc on the > scheme. If there is a better way, I am all eyes. One thought would be to add a couple of constraints: a CHECK constraint to ensure that one and only one of the columns is populated (think "t_number IS NOT NULL AND t_string IS NULL AND t_boolean IS NULL AND t_date IS NULL OR..."), and a UNIQUE constraint against (context_key, t_number, t_string, t_boolean, t_date). That's not really a "better" way, but it should prevent both duplicate and "compound" data. rls -- :wq -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql