Re: FK Constraint sort order with pg_dump

Поиск
Список
Период
Сортировка
От Christian Barthel
Тема Re: FK Constraint sort order with pg_dump
Дата
Msg-id 87bkti4a9d.fsf@online.de
обсуждение исходный текст
Ответ на Re: FK Constraint sort order with pg_dump  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: FK Constraint sort order with pg_dump  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: FK Constraint sort order with pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Thursday, July 21, 2022, Adrian Klaver wrote:

> On 7/21/22 10:25, Christian Barthel wrote:
>> Hello, The sorting order of FK constraints with the same name is
>> based on the OID (because it lands in the “Usually shouldn’t get
>> here” OID comparison block at [1]).  Wouldn’t it be better if the
>> order of those constraints were based on the table name?
>>
>
> Why does it matter?

As the comment in pg_dump.c states, logically identical schemas should
produce identical dumps:

| * We rely on dependency information to help us determine a safe order,
| so * the initial sort is mostly for cosmetic purposes: we sort by name
| to * ensure that logically identical schemas will dump identically.
  <https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/bin/pg_dump/pg_dump.c#l883>

This is done for most objects (tables, functions etc).  Why not for FK
constraints?

It makes comparing schemas on different postgres instances simpler
(i.e. when you’re working with testing, staging, live systems etc).

--
Christian Barthel



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: FK Constraint sort order with pg_dump
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: FK Constraint sort order with pg_dump