Repository: incubator-hawq
Updated Branches:
  refs/heads/master 6b2a18e72 -> f27bbd0d1


Revert "HAWQ-1195. Fixed error "Two or more external tables use the same error 
table ""

This reverts commit fad1b90505b3112d480cf1635f16edd8a957cc85.
Because regression test failed.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/f27bbd0d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/f27bbd0d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/f27bbd0d

Branch: refs/heads/master
Commit: f27bbd0d16fb676f568349be827262390b7608c2
Parents: 6b2a18e
Author: Ming LI <[email protected]>
Authored: Mon Dec 12 16:04:59 2016 +0800
Committer: Ming LI <[email protected]>
Committed: Mon Dec 12 16:05:32 2016 +0800

----------------------------------------------------------------------
 src/backend/executor/execMain.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/f27bbd0d/src/backend/executor/execMain.c
----------------------------------------------------------------------
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 27c1b15..578b9e8 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -258,6 +258,25 @@ SetupSegnoForErrorTable(Node *node, QueryCxtWalkerCxt *cxt)
                        if (!OidIsValid(scan->fmterrtbl))
                                return false;
 
+                       /*
+                        * check if two external table use the same error table 
in a statement
+                        */
+                       if (info->errTblOid)
+                       {
+                               ListCell           *c;
+                               Oid                             errtbloid;
+                               foreach(c, info->errTblOid)
+                               {
+                                       errtbloid = lfirst_oid(c);
+                                       if (errtbloid == scan->fmterrtbl)
+                                       {
+                                               Relation rel = 
heap_open(scan->fmterrtbl, AccessShareLock);
+                                               elog(ERROR, "Two or more 
external tables use the same error table \"%s\" in a statement",
+                                                               
RelationGetRelationName(rel));
+                                       }
+                               }
+                       }
+
             /*
              * Prepare error table for insert.
              */
@@ -266,12 +285,12 @@ SetupSegnoForErrorTable(Node *node, QueryCxtWalkerCxt 
*cxt)
             scan->errAosegnos = errSegnos;
             info->errTblOid = lcons_oid(scan->fmterrtbl, info->errTblOid);
 
-            Relation errRel = heap_open(scan->fmterrtbl, NoLock);
+            Relation errRel = heap_open(scan->fmterrtbl, RowExclusiveLock);
             CreateAppendOnlyParquetSegFileForRelationOnMaster(errRel, 
errSegnos);
             prepareDispatchedCatalogSingleRelation(info, scan->fmterrtbl, 
TRUE, errSegnos);
             scan->err_aosegfileinfos = fetchSegFileInfos(scan->fmterrtbl, 
errSegnos);
 
-            heap_close(errRel, NoLock);
+            heap_close(errRel, RowExclusiveLock);
 
             return false;
                default:

Reply via email to