Re: Bulk inserts into two (related) tables

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Re: Bulk inserts into two (related) tables
Дата
Msg-id alpine.LNX.2.20.1905221154441.1484@salmo.appl-ecosys.com
обсуждение исходный текст
Ответ на Re: Bulk inserts into two (related) tables  (Jeremy Finzel <finzelj@gmail.com>)
Список pgsql-general
On Wed, 22 May 2019, Jeremy Finzel wrote:

> Are you saying your database already has an organizations table, and this
> data file is appending to it with all-brand-new organizations and people?

Jeremy,

The database has both organizations and people tables (among others) which
are already populated. The source file appends rows to both tables.

> Say you have 800 people. Are you honestly saying that there are also 800
> organizations? If so, I guess your solution would work. However, I thought
> that it was the case that multiple people belong to the same organization.
> Hence, the entire problem of mapping we have been discussing.

No. But, each organization may have several people, each one at a different
facility. Think of a bank with one headquarters but different mangers in
each of their branches.

> Also, you said previously that some fields from your data file would be
> populated in *both tables*. That is a fundamental violation of DB design.
> Why are you duplicating that data in two places?

Not if the duplicated data field is the primary key in the organizations
table and the referenced foreign key in the people table.

Regards,

Rich



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

Предыдущее
От: Jeremy Finzel
Дата:
Сообщение: Re: Bulk inserts into two (related) tables
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Bulk inserts into two (related) tables