Re: pointless check in RelationBuildPartitionDesc - Mailing list pgsql-hackers

From Amit Langote
Subject Re: pointless check in RelationBuildPartitionDesc
Date
Msg-id 5a60c5c4-6d19-4803-31d6-58e9dbeb0ac9@lab.ntt.co.jp
Whole thread Raw
In response to Re: pointless check in RelationBuildPartitionDesc  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: pointless check in RelationBuildPartitionDesc  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On 2018/09/05 1:50, Alvaro Herrera wrote:
> Proposed patch.  Checking isnull in a elog(ERROR) is important, because
> the column is not marked NOT NULL.  This is not true for other columns
> where we simply do Assert(!isnull).

Looks good.  Thanks for taking care of other sites as well.

@@ -14705,7 +14705,9 @@ ATExecDetachPartition(Relation rel, RangeVar *name)

     (void) SysCacheGetAttr(RELOID, tuple, Anum_pg_class_relpartbound,
                            &isnull);
-    Assert(!isnull);
+    if (isnull)
+        elog(ERROR, "null relpartbound for relation %u",
+             RelationGetRelid(partRel));

In retrospect, I'm not sure why this piece of code is here at all; maybe
just remove the SycCacheGetAttr and Assert?

Regards,
Amit



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Bug fix for glibc broke freebsd build in REL_11_STABLE
Next
From: Amit Kapila
Date:
Subject: Re: pg_verify_checksums failure with hash indexes