Re: pg_dump emits ALTER TABLE ONLY partitioned_table - Mailing list pgsql-hackers

From Robert Haas
Subject Re: pg_dump emits ALTER TABLE ONLY partitioned_table
Date
Msg-id CA+TgmoYpVps0dH_Nj7At5yonKJZ-Qzezq4Z_3ZnYLPwZgGgBZg@mail.gmail.com
Whole thread Raw
In response to Re: pg_dump emits ALTER TABLE ONLY partitioned_table  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-hackers
On Tue, Mar 28, 2017 at 6:50 AM, Amit Langote
<Langote_Amit_f8@lab.ntt.co.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



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Monitoring roles patch
Next
From: Peter Eisentraut
Date:
Subject: Re: Removing binaries