Re: A bug in mapping attributes in ATExecAttachPartition()

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>, pgsql-hackers <pgsql-hackers@postgresql.org>, Amit Langote <amitlangote09@gmail.com>
Date: 2017-08-01T17:54:42Z
Lists: pgsql-hackers
On Mon, Jul 31, 2017 at 11:10 PM, Amit Langote
<Langote_Amit_f8@lab.ntt.co.jp> wrote:
> OK, these cosmetic changes are now in attached patch 0001.

Regarding 0001:

-    List       *childrels;
+    List       *attachRel_children;

I sorta don't see why this is necessary, or better.

     /* It's safe to skip the validation scan after all */
     if (skip_validate)
+    {
+        /* No need to scan the table after all. */

The existing comment should be removed along with adding the new one, I think.

-            if (part_rel != attachRel &&
-                part_rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
+            if (part_rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
             {
-                heap_close(part_rel, NoLock);
+                if (part_rel != attachRel)
+                    heap_close(part_rel, NoLock);

This works out to a cosmetic change, I guess, but it makes it worse...

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Commits

  1. Fix inconsistent capitalization.

  2. Fix bug in deciding whether to scan newly-attached partition.

  3. Fix lock upgrade hazard in ATExecAttachPartition.

  4. Code beautification for ATExecAttachPartition.

  5. Teach predtest.c about CHECK clauses to fix partitioning bugs.

  6. Don't explicitly mark range partitioning columns NOT NULL.