From: | Mike Blackwell <maiku41(at)sbcglobal(dot)net> |
---|---|
To: | Erik Jones <erik(at)myemma(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Using meta-data for foreign key? |
Date: | 2008-04-17 16:32:28 |
Message-ID: | 48077B9C.6000908@sbcglobal.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
More detail, as suggested.
I have an existing table in an app, along the lines of:
>>
>> CREATE TABLE foo (
>> name text,
>> address text,
>> some_numeric_info integer,
>> <a bunch of additional fields here>
>> );
>>
I essentially need another table
CREATE TABLE foo_printing_options (
field_name text,
print_order int not null,
suppress boolean not null,
<a couple additional options here>
);
The values of field_name in foo_printing_options would be the individual
field names in foo (i.e. name, address, etc). foo_printing_options
would be available to the user via the app to allow them to specify
report layout.
My question, then, is if it considered acceptable practice to, instead
of having field_name in the secondary table, have a foreign key
reference back to the field definition in the meta-data. This would
allow the app to be less sensitive to schema changes (fairly common).
Is linking to the metadata from the app tables directly bad? Unsafe? Ok?
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-04-17 16:44:33 | Re: Using meta-data for foreign key? |
Previous Message | Erik Jones | 2008-04-17 16:14:57 | Re: Using meta-data for foreign key? |