Re: pg_dump emits ALTER TABLE ONLY partitioned_table

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_dump emits ALTER TABLE ONLY partitioned_table
Date: 2017-03-28 15:39:03
Message-ID: CA+TgmoYpVps0dH_Nj7At5yonKJZ-Qzezq4Z_3ZnYLPwZgGgBZg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 28, 2017 at 6:50 AM, Amit Langote
<Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>> Isn't it bogus that this is generating ALTER TABLE .. SET NOT NULL
>> columns at all? You didn't say anything like that when setting up the
>> database, so why should it be there when dumping?
>
> So we should find a way for the NOT NULL constraints added for the range
> partition key columns to not be emitted *separately*? Like when a table
> has primary key:
>
> --
> -- Name: foo; Type: TABLE; Schema: public; Owner: amit
> --
>
> CREATE TABLE foo (
> a integer NOT NULL
> );
>
>
> ALTER TABLE foo OWNER TO amit;
>
> --
> -- Name: foo foo_pkey; Type: CONSTRAINT; Schema: public; Owner: amit
> --
>
> ALTER TABLE ONLY foo
> ADD CONSTRAINT foo_pkey PRIMARY KEY (a);
>
> The NOT NULL constraint is emitted with CREATE TABLE, not separately.

Hmm, that's not exactly what I was thinking, but I think what I was
thinking was wrong, so, yes, can we do what you said?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-03-28 15:44:28 Re: Removing binaries
Previous Message Peter Eisentraut 2017-03-28 15:37:42 Re: Monitoring roles patch