Re: Dump/Restore of non-default PKs

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Dump/Restore of non-default PKs
Date: 2022-04-18 21:00:17
Message-ID: CAKFQuwaqpco6H_26E-xaDQLu-m_oZ8pXN4yT_wyEu9cuB+dSOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 18, 2022 at 1:48 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On Mon, Apr 18, 2022 at 1:00 PM Simon Riggs <
> simon(dot)riggs(at)enterprisedb(dot)com>
> > wrote:
> >> I propose that we change pg_dump so that when it creates a PK it does
> >> so in 2 commands:
> >> 1. CREATE [UNIQUE] INDEX iname ...
> >> 2. ALTER TABLE .. ADD PRIMARY KEY USING INDEX iname;
>
> > Why not just get rid of the limitation that constraint definitions don't
> > support non-default methods?
>
> That approach would be doubling down on the assumption that we can always
> shoehorn more custom options into SQL-standard constraint clauses, and
> we'll never fall foul of shift/reduce problems or future spec additions.
> I think for example that USING INDEX TABLESPACE is a blot on humanity,
> and I'd be very glad to see pg_dump stop using it in favor of doing
> things as Simon suggests.
>
>
I'm convinced.

As for portability - that would be something we could explicitly define and
support through a pg_dump option. In compatibility mode you get whatever
the default index would be for your engine while by default we output the
existing index as defined and then alter-add it to the table.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2022-04-18 21:05:57 Re: Dump/Restore of non-default PKs
Previous Message Greg Stark 2022-04-18 20:53:53 Re: avoid multiple hard links to same WAL file after a crash