Обсуждение: psort fixed

Поиск
Список
Период
Сортировка

psort fixed

От
Bruce Momjian
Дата:
I have fixed the regression test problem.  The original psort() NULL
handling patch is attached.  It made the while() into a for() which is
good, but he did not remove the increment at the bottom or the for(), so
nkey was being incremented twice in the loop.  Fixed it, and now
regression looks good to me.

I have updated the files in tools/RELEASE_CHANGES to say 6.3, so I think
we are ready for some announcement on 6.3 beta, Marc.  I recommend you
attach the HISTORY file for the release, so people know what is new.


---------------------------------------------------------------------------

Index: psort.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/utils/sort/psort.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -c -r1.33 -r1.34
*** psort.c    1998/01/25 05:14:49    1.33
--- psort.c    1998/01/25 05:18:34    1.34
***************
*** 7,13 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /usr/local/cvsroot/pgsql/src/backend/utils/sort/psort.c,v 1.33 1998/01/25 05:14:49 momjian Exp $
   *
   * NOTES
   *        Sorts the first relation into the second relation.
--- 7,13 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /usr/local/cvsroot/pgsql/src/backend/utils/sort/psort.c,v 1.34 1998/01/25 05:18:34 scrappy Exp $
   *
   * NOTES
   *        Sorts the first relation into the second relation.
***************
*** 1094,1100 ****
      int        result = 0;
      bool    isnull1, isnull2;

!     while ( nkey < PsortNkeys && !result )
      {
          lattr = heap_getattr(*ltup, InvalidBuffer,
                       PsortKeys[nkey].sk_attno,
--- 1094,1100 ----
      int        result = 0;
      bool    isnull1, isnull2;

!     for (nkey = 0; nkey < PsortNkeys && !result; nkey++ )
      {
          lattr = heap_getattr(*ltup, InvalidBuffer,
                       PsortKeys[nkey].sk_attno,
***************
*** 1106,1119 ****
                       &isnull2);
          if ( isnull1 )
          {
!             if ( isnull2 )
!                 return (0);
!             return(1);
          }
          else if ( isnull2 )
!             return (-1);

!         if (PsortKeys[nkey].sk_flags & SK_COMMUTE)
          {
              if (!(result = -(long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (rattr, lattr)))
              result = (long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (lattr, rattr);
--- 1106,1118 ----
                       &isnull2);
          if ( isnull1 )
          {
!             if ( !isnull2 )
!                 result = 1;
          }
          else if ( isnull2 )
!             result = -1;

!         else if (PsortKeys[nkey].sk_flags & SK_COMMUTE)
          {
              if (!(result = -(long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (rattr, lattr)))
              result = (long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (lattr, rattr);

--
Bruce Momjian
maillist@candle.pha.pa.us

Re: [HACKERS] psort fixed

От
"Thomas G. Lockhart"
Дата:
> I have fixed the regression test problem.  The original psort() NULL
> handling patch is attached.  It made the while() into a for() which is
> good, but he did not remove the increment at the bottom or the for(), so
> nkey was being incremented twice in the loop.  Fixed it, and now
> regression looks good to me.

We be stylin' now... Nice.

                                            - Tom