Re: cataloguing NOT NULL constraints

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: cataloguing NOT NULL constraints
Date: 2023-04-08 00:41:47
Message-ID: 20230408004147.yewhuarcpl7tzmk6@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-04-07 17:19:42 -0700, Andres Freund wrote:
> I think
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=drongo&dt=2023-04-07%2021%3A16%3A04
> might point out a problem with the pg_dump or pg_upgrade backward compat
> paths:
>
> --- C:\\prog\\bf/root/upgrade.drongo/HEAD/origin-REL9_5_STABLE.sql.fixed 2023-04-07 23:51:27.641328600 +0000
> +++ C:\\prog\\bf/root/upgrade.drongo/HEAD/converted-REL9_5_STABLE-to-HEAD.sql.fixed 2023-04-07 23:51:27.672571900 +0000
> @@ -416,9 +416,9 @@
> -- Name: entry; Type: TABLE; Schema: public; Owner: buildfarm
> --
> CREATE TABLE public.entry (
> - accession text,
> - eid integer,
> - txid smallint
> + accession text NOT NULL,
> + eid integer NOT NULL,
> + txid smallint NOT NULL
> );
> ALTER TABLE public.entry OWNER TO buildfarm;
> --
>
> Looks like we're making up NOT NULL constraints when migrating from 9.5, for
> some reason?

My compiler complains:

../../../../home/andres/src/postgresql/src/backend/catalog/heap.c: In function ‘AddRelationNotNullConstraints’:
../../../../home/andres/src/postgresql/src/backend/catalog/heap.c:2829:37: warning: ‘conname’ may be used uninitialized [-Wmaybe-uninitialized]
2829 | if (strcmp(lfirst(lc2), conname) == 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../home/andres/src/postgresql/src/backend/catalog/heap.c:2802:29: note: ‘conname’ was declared here
2802 | char *conname;
| ^~~~~~~

I think the compiler may be right - I think the first use of conname might
have been intended as constr->conname?

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-04-08 00:49:39 Re: Making background psql nicer to use in tap tests
Previous Message Tom Lane 2023-04-08 00:38:03 Re: Making background psql nicer to use in tap tests