Re: [HACKERS] Bug in 6.4 release

Поиск
Список
Период
Сортировка
От Vadim Mikheev
Тема Re: [HACKERS] Bug in 6.4 release
Дата
Msg-id 3657E815.5B62B14B@krs.ru
обсуждение исходный текст
Ответ на Re: [HACKERS] Bug in 6.4 release  (Bruce Momjian <maillist@candle.pha.pa.us>)
Ответы Re: [HACKERS] Bug in 6.4 release
Список pgsql-hackers
Bruce Momjian wrote:
>
> This new patch uses scankeys instead of throwing the indexqual to the
> executor.  This is probably more efficient, but I am not sure about the
> other ramifications.  It still fails.

This wouldn't handle functional indices in OR...

So, I added indexqualorig list to the IndexScan node:

indexqual = fix_indxqual_references (indexqualorig)

- indxqualorig' Var-s references heap tuple...

Regression tests are ok.
Patch made for CURRENT tree - let me know if there will
be problems with 6.4...

It's better to gmake clean in backend dir...

Patch also fixes EXPLAIN for indices in OR: all indices
used are explained now.

Vadim*** src/include/nodes/plannodes.h.orig    Sun Nov 22 15:54:23 1998
--- src/include/nodes/plannodes.h    Sun Nov 22 15:58:02 1998
***************
*** 174,179 ****
--- 174,180 ----
      Scan        scan;
      List       *indxid;
      List       *indxqual;
+     List       *indxqualorig;
      IndexScanState *indxstate;
  } IndexScan;

*** src/backend/commands/explain.c.orig    Sun Nov 22 16:36:14 1998
--- src/backend/commands/explain.c    Sun Nov 22 16:40:27 1998
***************
*** 223,231 ****
      {
          case T_IndexScan:
              appendStringInfo(str, " using ");
!             l = ((IndexScan *) plan)->indxid;
!             relation = RelationIdCacheGetRelation((int) lfirst(l));
!             appendStringInfo(str, (RelationGetRelationName(relation))->data);
          case T_SeqScan:
              if (((Scan *) plan)->scanrelid > 0)
              {
--- 223,236 ----
      {
          case T_IndexScan:
              appendStringInfo(str, " using ");
!             i = 0;
!             foreach (l, ((IndexScan *) plan)->indxid)
!             {
!                 relation = RelationIdCacheGetRelation((int) lfirst(l));
!                 if (++i > 1)
!                     appendStringInfo(str, ", ");
!                 appendStringInfo(str, (RelationGetRelationName(relation))->data);
!             }
          case T_SeqScan:
              if (((Scan *) plan)->scanrelid > 0)
              {
*** src/backend/executor/nodeIndexscan.c.orig    Sun Nov 22 16:00:23 1998
--- src/backend/executor/nodeIndexscan.c    Sun Nov 22 15:59:10 1998
***************
*** 154,160 ****
                       prev_index++)
                  {
                      scanstate->cstate.cs_ExprContext->ecxt_scantuple = slot;
!                     if (ExecQual(nth(prev_index, node->indxqual),
                                   scanstate->cstate.cs_ExprContext))
                      {
                          prev_matches = true;
--- 154,160 ----
                       prev_index++)
                  {
                      scanstate->cstate.cs_ExprContext->ecxt_scantuple = slot;
!                     if (ExecQual(nth(prev_index, node->indxqualorig),
                                   scanstate->cstate.cs_ExprContext))
                      {
                          prev_matches = true;
*** src/backend/nodes/copyfuncs.c.orig    Sun Nov 22 16:05:20 1998
--- src/backend/nodes/copyfuncs.c    Sun Nov 22 16:03:58 1998
***************
*** 247,252 ****
--- 247,253 ----
       */
      newnode->indxid = listCopy(from->indxid);
      Node_Copy(from, newnode, indxqual);
+     Node_Copy(from, newnode, indxqualorig);
      Node_Copy(from, newnode, indxstate);

      return newnode;
*** src/backend/nodes/outfuncs.c.orig    Sun Nov 22 16:07:31 1998
--- src/backend/nodes/outfuncs.c    Sun Nov 22 16:07:06 1998
***************
*** 517,522 ****
--- 517,525 ----
      appendStringInfo(str, " :indxqual ");
      _outNode(str, node->indxqual);

+     appendStringInfo(str, " :indxqualorig ");
+     _outNode(str, node->indxqualorig);
+
  }

  /*
*** src/backend/nodes/readfuncs.c.orig    Sun Nov 22 16:09:41 1998
--- src/backend/nodes/readfuncs.c    Sun Nov 22 16:09:08 1998
***************
*** 546,551 ****
--- 546,554 ----
      token = lsptok(NULL, &length);        /* eat :indxqual */
      local_node->indxqual = nodeRead(true);        /* now read it */

+     token = lsptok(NULL, &length);        /* eat :indxqualorig */
+     local_node->indxqualorig = nodeRead(true);        /* now read it */
+
      return local_node;
  }

*** src/backend/optimizer/plan/createplan.c.orig    Sun Nov 22 16:00:59 1998
--- src/backend/optimizer/plan/createplan.c    Sun Nov 22 16:02:41 1998
***************
*** 63,69 ****
  static Temp *make_temp(List *tlist, List *keys, Oid *operators,
            Plan *plan_node, int temptype);
  static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
!                List *indxid, List *indxqual, Cost cost);
  static NestLoop *make_nestloop(List *qptlist, List *qpqual, Plan *lefttree,
                Plan *righttree);
  static HashJoin *make_hashjoin(List *tlist, List *qpqual,
--- 63,69 ----
  static Temp *make_temp(List *tlist, List *keys, Oid *operators,
            Plan *plan_node, int temptype);
  static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
!                List *indxid, List *indxqual, List *indxqualorig, Cost cost);
  static NestLoop *make_nestloop(List *qptlist, List *qpqual, Plan *lefttree,
                Plan *righttree);
  static HashJoin *make_hashjoin(List *tlist, List *qpqual,
***************
*** 405,410 ****
--- 405,411 ----
                         lfirsti(best_path->path.parent->relids),
                         best_path->indexid,
                         fixed_indxqual,
+                        indxqual,
                         best_path->path.path_cost);

      return scan_node;
***************
*** 937,942 ****
--- 938,944 ----
                 Index scanrelid,
                 List *indxid,
                 List *indxqual,
+                List *indxqualorig,
                 Cost cost)
  {
      IndexScan  *node = makeNode(IndexScan);
***************
*** 951,956 ****
--- 953,959 ----
      node->scan.scanrelid = scanrelid;
      node->indxid = indxid;
      node->indxqual = indxqual;
+     node->indxqualorig = indxqualorig;
      node->scan.scanstate = (CommonScanState *) NULL;

      return node;

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Bug in 6.4 release
Следующее
От: Keith Parks
Дата:
Сообщение: Problems with CVS.