Re: cataloguing NOT NULL constraints

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: cataloguing NOT NULL constraints
Date: 2022-09-10 00:28:19
Message-ID: CALNJ-vTdsYpb_21K9NhbFe4Y+oCfvRebm46aBHw3ktpZ9PcHdQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
w.r.t. the while loop in findNotNullConstraintAttnum():

+ if (multiple == NULL)
+ break;

I think `pfree(arr)` should be called before breaking.

+ if (constraint->cooked_expr != NULL)
+ return
tryExtractNotNullFromNode(stringToNode(constraint->cooked_expr), rel);
+ else
+ return tryExtractNotNullFromNode(constraint->raw_expr, rel);

nit: the `else` keyword is not needed.

+ if (isnull)
+ elog(ERROR, "null conbin for constraint %u", conForm->oid);

It would be better to expand `conbin` so that the user can better
understand the error.

Cheers

>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message andrey.arapov 2022-09-10 01:24:36 [PATCH] initdb: do not exit after warn_on_mount_point
Previous Message Melih Mutlu 2022-09-09 23:59:50 Re: Summary function for pg_buffercache