Re: cataloguing NOT NULL constraints - Mailing list pgsql-hackers

From Andres Freund
Subject Re: cataloguing NOT NULL constraints
Date
Msg-id 20230408004147.yewhuarcpl7tzmk6@awork3.anarazel.de
Whole thread Raw
In response to Re: cataloguing NOT NULL constraints  (Andres Freund <andres@anarazel.de>)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Making background psql nicer to use in tap tests
Next
From: Tom Lane
Date:
Subject: Re: Making background psql nicer to use in tap tests