BUG #19074: pg_dump from v18 loses the NOT NULL flag in the inherited table field when dumping v17-databases

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: andrewbille(at)gmail(dot)com
Subject: BUG #19074: pg_dump from v18 loses the NOT NULL flag in the inherited table field when dumping v17-databases
Date: 2025-10-05 05:20:21
Message-ID: 19074-ae2548458cf0195c@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19074
Logged by: Andrew Bille
Email address: andrewbille(at)gmail(dot)com
PostgreSQL version: 18.0
Operating system: Ubuntu 20.04
Description:

Hello.

In 17.6, we're creating tables:

CREATE TABLE p (a integer);
CREATE TABLE c () INHERITS (p);
ALTER TABLE ONLY c ALTER COLUMN a SET NOT NULL;

17/bin/pg_dump test returns:

....
CREATE TABLE public.p (
a integer
);

ALTER TABLE public.p OWNER TO andrew;

--
-- Name: c; Type: TABLE; Schema: public; Owner: andrew
--

CREATE TABLE public.c (
)
INHERITS (public.p);
ALTER TABLE ONLY public.c ALTER COLUMN a SET NOT NULL;
....

REL_18_0, REL_18_STABLE, master
master/bin/pg_dump test produces:

...
CREATE TABLE public.p (
a integer
);

ALTER TABLE public.p OWNER TO andrew;

--
-- Name: c; Type: TABLE; Schema: public; Owner: Andrew
--

CREATE TABLE public.c (
)
INHERITS (public.p);

ALTER TABLE public.c OWNER TO andrew;

--
-- Data for Name: c; Type: TABLE DATA; Schema: public; Owner: Andrew
--

COPY public.c (a) FROM stdin;
\.
...

and loses NOT NULL in the inherited table

Regards, Andrew

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Marko Tiikkaja 2025-10-05 06:38:14 Re: [BUGS] BUG #11500: PRIMARY KEY index not being used
Previous Message PG Bug reporting form 2025-10-05 02:29:34 BUG #19073: there are meaningless code in _SPI_execute_plan() when canSetTag is true