Re: Using meta-data for foreign key?

Поиск
Список
Период
Сортировка
От Mike Blackwell
Тема Re: Using meta-data for foreign key?
Дата
Msg-id 48077B9C.6000908@sbcglobal.net
обсуждение исходный текст
Ответ на Re: Using meta-data for foreign key?  (Erik Jones <erik@myemma.com>)
Ответы Re: Using meta-data for foreign key?
Re: Using meta-data for foreign key?
Список 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?


В списке pgsql-general по дате отправления:

Предыдущее
От: Ottavio Campana
Дата:
Сообщение: problem with tsearch and utf-8 on postgresql 8.1
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Using meta-data for foreign key?