lcons -> makeList patch - Mailing list pgsql-patches

From Bruce Momjian
Subject lcons -> makeList patch
Date
Msg-id 200101171751.MAA27507@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
Here is the patch, in case anyone is curious.  Not much to it.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
? Makefile.custom
? GNUmakefile
? Makefile.global
? log
? crtags
? backend/postgres
? backend/catalog/global.description
? backend/catalog/global.bki
? backend/catalog/template1.bki
? backend/catalog/template1.description
? backend/parser/scan.y
? backend/port/Makefile
? bin/initdb/initdb
? bin/initlocation/initlocation
? bin/ipcclean/ipcclean
? bin/pg_config/pg_config
? bin/pg_ctl/pg_ctl
? bin/pg_dump/pg_dump
? bin/pg_dump/pg_restore
? bin/pg_dump/pg_dumpall
? bin/pg_id/pg_id
? bin/pg_passwd/pg_passwd
? bin/pgaccess/pgaccess
? bin/pgtclsh/Makefile.tkdefs
? bin/pgtclsh/Makefile.tcldefs
? bin/pgtclsh/pgtclsh
? bin/pgtclsh/pgtksh
? bin/psql/psql
? bin/scripts/createlang
? include/config.h
? include/stamp-h
? interfaces/ecpg/lib/libecpg.so.3.2.0
? interfaces/ecpg/preproc/ecpg
? interfaces/libpgeasy/libpgeasy.so.2.1
? interfaces/libpgtcl/libpgtcl.so.2.1
? interfaces/libpq/libpq.so.2.1
? interfaces/perl5/blib
? interfaces/perl5/Makefile
? interfaces/perl5/pm_to_blib
? interfaces/perl5/Pg.c
? interfaces/perl5/Pg.bs
? pl/plperl/blib
? pl/plperl/Makefile
? pl/plperl/pm_to_blib
? pl/plperl/SPI.c
? pl/plperl/plperl.bs
? pl/plpgsql/src/libplpgsql.so.1.0
? pl/tcl/Makefile.tcldefs
? test/regress/pg_regress
? test/regress/results
? test/regress/expected/copy.out
? test/regress/expected/create_function_1.out
? test/regress/expected/create_function_2.out
? test/regress/expected/misc.out
? test/regress/expected/constraints.out
? test/regress/sql/copy.sql
? test/regress/sql/create_function_1.sql
? test/regress/sql/create_function_2.sql
? test/regress/sql/misc.sql
? test/regress/sql/constraints.sql
Index: backend/bootstrap/bootparse.y
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v
retrieving revision 1.33
retrieving revision 1.34
diff -c -r1.33 -r1.34
*** backend/bootstrap/bootparse.y    2000/11/21 21:15:59    1.33
--- backend/bootstrap/bootparse.y    2001/01/17 17:26:44    1.34
***************
*** 9,15 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.33 2000/11/21 21:15:59
petereExp $ 
   *
   *-------------------------------------------------------------------------
   */
--- 9,15 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.34 2001/01/17 17:26:44
momjianExp $ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 254,260 ****

  boot_index_params:
          boot_index_params COMMA boot_index_param    { $$ = lappend($1, $3); }
!         | boot_index_param                            { $$ = lcons($1, NIL); }
          ;

  boot_index_param:
--- 254,260 ----

  boot_index_params:
          boot_index_params COMMA boot_index_param    { $$ = lappend($1, $3); }
!         | boot_index_param                            { $$ = makeList1($1); }
          ;

  boot_index_param:
Index: backend/commands/user.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/commands/user.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -c -r1.70 -r1.71
*** backend/commands/user.c    2000/11/16 22:30:19    1.70
--- backend/commands/user.c    2001/01/17 17:26:44    1.71
***************
*** 6,12 ****
   * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  * $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/commands/user.c,v 1.70 2000/11/16 22:30:19 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 6,12 ----
   * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  * $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/commands/user.c,v 1.71 2001/01/17 17:26:44 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
***************
*** 311,317 ****
          ags.name = strVal(lfirst(item));        /* the group name to add
                                                   * this in */
          ags.action = +1;
!         ags.listUsers = lcons((void *) makeInteger(havesysid ? stmt->sysid : max_id + 1), NIL);
          AlterGroup(&ags, "CREATE USER");
      }

--- 311,318 ----
          ags.name = strVal(lfirst(item));        /* the group name to add
                                                   * this in */
          ags.action = +1;
!         ags.listUsers = makeList1(makeInteger(havesysid ?
!                             stmt->sysid : max_id + 1));
          AlterGroup(&ags, "CREATE USER");
      }

***************
*** 600,606 ****
              datum = heap_getattr(tmp_tuple, Anum_pg_group_groname, pg_dsc, &null);
              ags.name = DatumGetCString(DirectFunctionCall1(nameout, datum));
              ags.action = -1;
!             ags.listUsers = lcons((void *) makeInteger(usesysid), NIL);
              AlterGroup(&ags, "DROP USER");
          }
          heap_endscan(scan);
--- 601,607 ----
              datum = heap_getattr(tmp_tuple, Anum_pg_group_groname, pg_dsc, &null);
              ags.name = DatumGetCString(DirectFunctionCall1(nameout, datum));
              ags.action = -1;
!             ags.listUsers = makeList1(makeInteger(usesysid));
              AlterGroup(&ags, "DROP USER");
          }
          heap_endscan(scan);
Index: backend/executor/execJunk.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/executor/execJunk.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -c -r1.22 -r1.23
*** backend/executor/execJunk.c    2000/01/26 05:56:21    1.22
--- backend/executor/execJunk.c    2001/01/17 17:26:44    1.23
***************
*** 8,14 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.22 2000/01/26 05:56:21
momjianExp $ 
   *
   *-------------------------------------------------------------------------
   */
--- 8,14 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.23 2001/01/17 17:26:44
momjianExp $ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 124,130 ****
              Fjoin       *fjNode = (Fjoin *) tl_node(fjList);

              cleanFjoin = (Fjoin) copyObject((Node) fjNode);
!             cleanFjList = lcons(cleanFjoin, NIL);

              resdom = (Resdom) lfirst(get_fj_innerNode(fjNode));
              expr = lsecond(get_fj_innerNode(fjNode));
--- 124,130 ----
              Fjoin       *fjNode = (Fjoin *) tl_node(fjList);

              cleanFjoin = (Fjoin) copyObject((Node) fjNode);
!             cleanFjList = makeList1(cleanFjoin);

              resdom = (Resdom) lfirst(get_fj_innerNode(fjNode));
              expr = lsecond(get_fj_innerNode(fjNode));
Index: backend/nodes/copyfuncs.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -c -r1.136 -r1.137
*** backend/nodes/copyfuncs.c    2001/01/05 06:34:17    1.136
--- backend/nodes/copyfuncs.c    2001/01/17 17:26:44    1.137
***************
*** 15,21 ****
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.136 2001/01/05 06:34:17 tgl Exp
$
   *
   *-------------------------------------------------------------------------
   */
--- 15,21 ----
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.137 2001/01/17 17:26:44 momjian
Exp$ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 58,68 ****
      if (list == NIL)
          return NIL;

!     newlist = nl = lcons(lfirst(list), NIL);

      foreach(l, lnext(list))
      {
!         lnext(nl) = lcons(lfirst(l), NIL);
          nl = lnext(nl);
      }
      return newlist;
--- 58,68 ----
      if (list == NIL)
          return NIL;

!     newlist = nl = makeList1(lfirst(list));

      foreach(l, lnext(list))
      {
!         lnext(nl) = makeList1(lfirst(l));
          nl = lnext(nl);
      }
      return newlist;
***************
*** 2745,2756 ****

                  /* rather ugly coding for speed... */
                  /* Note the input list cannot be NIL if we got here. */
!                 nl = lcons(copyObject(lfirst(list)), NIL);
                  retval = nl;

                  foreach(l, lnext(list))
                  {
!                     lnext(nl) = lcons(copyObject(lfirst(l)), NIL);
                      nl = lnext(nl);
                  }
              }
--- 2745,2756 ----

                  /* rather ugly coding for speed... */
                  /* Note the input list cannot be NIL if we got here. */
!                 nl = makeList1(copyObject(lfirst(list)));
                  retval = nl;

                  foreach(l, lnext(list))
                  {
!                     lnext(nl) = makeList1(copyObject(lfirst(l)));
                      nl = lnext(nl);
                  }
              }
Index: backend/nodes/list.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/list.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -c -r1.36 -r1.37
*** backend/nodes/list.c    2000/10/31 10:22:10    1.36
--- backend/nodes/list.c    2001/01/17 17:26:44    1.37
***************
*** 8,14 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/list.c,v 1.36 2000/10/31 10:22:10 petere Exp $
   *
   * NOTES
   *      XXX a few of the following functions are duplicated to handle
--- 8,14 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/list.c,v 1.37 2001/01/17 17:26:44 momjian Exp $
   *
   * NOTES
   *      XXX a few of the following functions are duplicated to handle
***************
*** 127,133 ****
  List *
  lappend(List *list, void *obj)
  {
!     return nconc(list, lcons(obj, NIL));
  }

  /*
--- 127,133 ----
  List *
  lappend(List *list, void *obj)
  {
!     return nconc(list, makeList1(obj));
  }

  /*
***************
*** 138,144 ****
  List *
  lappendi(List *list, int datum)
  {
!     return nconc(list, lconsi(datum, NIL));
  }

  /*
--- 138,144 ----
  List *
  lappendi(List *list, int datum)
  {
!     return nconc(list, makeListi1(datum));
  }

  /*
Index: backend/nodes/makefuncs.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/makefuncs.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -c -r1.23 -r1.24
*** backend/nodes/makefuncs.c    2000/11/16 22:30:23    1.23
--- backend/nodes/makefuncs.c    2001/01/17 17:26:44    1.24
***************
*** 8,14 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.23 2000/11/16 22:30:23 tgl Exp
$
   *
   * NOTES
   *      Creator functions in POSTGRES 4.2 are generated automatically. Most of
--- 8,14 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.24 2001/01/17 17:26:44 momjian
Exp$ 
   *
   * NOTES
   *      Creator functions in POSTGRES 4.2 are generated automatically. Most of
***************
*** 178,184 ****
      a->relname = pstrdup(relname);
      a->paramNo = NULL;
      if (attname != NULL)
!         a->attrs = lcons(makeString(pstrdup(attname)), NIL);
      a->indirection = NULL;

      return a;
--- 178,184 ----
      a->relname = pstrdup(relname);
      a->paramNo = NULL;
      if (attname != NULL)
!         a->attrs = makeList1(makeString(pstrdup(attname)));
      a->indirection = NULL;

      return a;
Index: backend/optimizer/README
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/README,v
retrieving revision 1.21
retrieving revision 1.22
diff -c -r1.21 -r1.22
*** backend/optimizer/README    2000/12/14 22:30:45    1.21
--- backend/optimizer/README    2001/01/17 06:41:31    1.22
***************
*** 80,86 ****
  for tab1 listing tab2 as an unjoined relation, and also one for tab2
  showing tab1 as an unjoined relation.

! If we have only a single base relation in the query, we are done now.
  Otherwise we have to figure out how to join the base relations into a
  single join relation.

--- 80,86 ----
  for tab1 listing tab2 as an unjoined relation, and also one for tab2
  showing tab1 as an unjoined relation.

! If we have only a single base relation in the query, we are done.
  Otherwise we have to figure out how to join the base relations into a
  single join relation.

Index: backend/optimizer/geqo/geqo_eval.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/geqo/geqo_eval.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -c -r1.55 -r1.56
*** backend/optimizer/geqo/geqo_eval.c    2000/09/19 18:42:33    1.55
--- backend/optimizer/geqo/geqo_eval.c    2001/01/17 17:26:44    1.56
***************
*** 6,12 ****
   * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  * $Id: geqo_eval.c,v 1.55 2000/09/19 18:42:33 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 6,12 ----
   * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  * $Id: geqo_eval.c,v 1.56 2001/01/17 17:26:44 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
***************
*** 122,128 ****
          else
          {
              /* tree main part */
!             List       *acceptable_rels = lcons(inner_rel, NIL);
              List       *new_rels;
              RelOptInfo *new_rel;

--- 122,128 ----
          else
          {
              /* tree main part */
!             List       *acceptable_rels = makeList1(inner_rel);
              List       *new_rels;
              RelOptInfo *new_rel;

Index: backend/optimizer/path/pathkeys.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -c -r1.28 -r1.29
*** backend/optimizer/path/pathkeys.c    2000/12/14 22:30:43    1.28
--- backend/optimizer/path/pathkeys.c    2001/01/17 17:26:45    1.29
***************
*** 11,17 ****
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.28 2000/12/14 22:30:43
tglExp $ 
   *
   *-------------------------------------------------------------------------
   */
--- 11,17 ----
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.29 2001/01/17 17:26:45
momjianExp $ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 119,125 ****

              /* Build the new set only when we know we must */
              if (newset == NIL)
!                 newset = lcons(item1, lcons(item2, NIL));

              /* Found a set to merge into our new set */
              newset = set_union(newset, curset);
--- 119,125 ----

              /* Build the new set only when we know we must */
              if (newset == NIL)
!                 newset = makeList2(item1, item2);

              /* Found a set to merge into our new set */
              newset = set_union(newset, curset);
***************
*** 135,141 ****

      /* Build the new set only when we know we must */
      if (newset == NIL)
!         newset = lcons(item1, lcons(item2, NIL));

      root->equi_key_list = lcons(newset, root->equi_key_list);
  }
--- 135,141 ----

      /* Build the new set only when we know we must */
      if (newset == NIL)
!         newset = makeList2(item1, item2);

      root->equi_key_list = lcons(newset, root->equi_key_list);
  }
***************
*** 534,540 ****
          /* Make a one-sublist pathkeys list for the function expression */
          item = makePathKeyItem((Node *) make_funcclause(funcnode, funcargs),
                                 sortop);
!         retval = lcons(make_canonical_pathkey(root, item), NIL);
      }
      else
      {
--- 534,540 ----
          /* Make a one-sublist pathkeys list for the function expression */
          item = makePathKeyItem((Node *) make_funcclause(funcnode, funcargs),
                                 sortop);
!         retval = makeList1(make_canonical_pathkey(root, item));
      }
      else
      {
***************
*** 678,684 ****
           * canonicalize_pathkeys() might replace it with a longer sublist
           * later.
           */
!         pathkeys = lappend(pathkeys, lcons(pathkey, NIL));
      }
      return pathkeys;
  }
--- 678,684 ----
           * canonicalize_pathkeys() might replace it with a longer sublist
           * later.
           */
!         pathkeys = lappend(pathkeys, makeList1(pathkey));
      }
      return pathkeys;
  }
Index: backend/optimizer/path/_deadcode/xfunc.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/path/_deadcode/xfunc.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -c -r1.13 -r1.14
*** backend/optimizer/path/_deadcode/xfunc.c    2000/01/26 05:56:36    1.13
--- backend/optimizer/path/_deadcode/xfunc.c    2001/01/17 17:26:45    1.14
***************
*** 10,16 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/path/_deadcode/xfunc.c,v 1.13 2000/01/26
05:56:36momjian Exp $ 
   *
   *-------------------------------------------------------------------------
   */
--- 10,16 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/path/_deadcode/xfunc.c,v 1.14 2001/01/17
17:26:45momjian Exp $ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 300,306 ****
                                          get_clause(cinfo), LispNil);
      xfunc_copyrel(get_parent(newkid), &newrel);
      set_parent(newkid, newrel);
!     set_pathlist(newrel, lcons(newkid, NIL));
      set_unorderedpath(newrel, (PathPtr) newkid);
      set_cheapestpath(newrel, (PathPtr) newkid);
      set_size(newrel,
--- 300,306 ----
                                          get_clause(cinfo), LispNil);
      xfunc_copyrel(get_parent(newkid), &newrel);
      set_parent(newkid, newrel);
!     set_pathlist(newrel, makeList1(newkid));
      set_unorderedpath(newrel, (PathPtr) newkid);
      set_cheapestpath(newrel, (PathPtr) newkid);
      set_size(newrel,
Index: backend/optimizer/prep/prepunion.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -c -r1.58 -r1.59
*** backend/optimizer/prep/prepunion.c    2000/12/14 22:30:44    1.58
--- backend/optimizer/prep/prepunion.c    2001/01/17 17:26:45    1.59
***************
*** 14,20 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.58 2000/12/14 22:30:44
tglExp $ 
   *
   *-------------------------------------------------------------------------
   */
--- 14,20 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.59 2001/01/17 17:26:45
momjianExp $ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 467,473 ****
  find_all_inheritors(Oid parentrel)
  {
      List       *examined_relids = NIL;
!     List       *unexamined_relids = lconsi(parentrel, NIL);

      /*
       * While the queue of unexamined relids is nonempty, remove the first
--- 467,473 ----
  find_all_inheritors(Oid parentrel)
  {
      List       *examined_relids = NIL;
!     List       *unexamined_relids = makeListi1(parentrel);

      /*
       * While the queue of unexamined relids is nonempty, remove the first
Index: backend/parser/gram.y
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.215
retrieving revision 2.216
diff -c -r2.215 -r2.216
*** backend/parser/gram.y    2001/01/15 20:36:36    2.215
--- backend/parser/gram.y    2001/01/17 17:26:45    2.216
***************
*** 11,17 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/gram.y,v 2.215 2001/01/15 20:36:36 tgl Exp $
   *
   * HISTORY
   *      AUTHOR            DATE            MAJOR EVENT
--- 11,17 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/gram.y,v 2.216 2001/01/17 17:26:45 momjian Exp
$
   *
   * HISTORY
   *      AUTHOR            DATE            MAJOR EVENT
***************
*** 2918,2924 ****
                  }
          | LOCATION '=' DEFAULT
                  {
!                     $$ = lconsi(1, makeList1((char *) NULL));
                  }
          | TEMPLATE '=' name
                  {
--- 2918,2924 ----
                  }
          | LOCATION '=' DEFAULT
                  {
!                     $$ = lconsi(1, makeList1(NULL));
                  }
          | TEMPLATE '=' name
                  {
***************
*** 2926,2932 ****
                  }
          | TEMPLATE '=' DEFAULT
                  {
!                     $$ = lconsi(2, makeList1((char *) NULL));
                  }
          | ENCODING '=' Sconst
                  {
--- 2926,2932 ----
                  }
          | TEMPLATE '=' DEFAULT
                  {
!                     $$ = lconsi(2, makeList1(NULL));
                  }
          | ENCODING '=' Sconst
                  {
***************
*** 3383,3389 ****

          /* easy way to return two values. Can someone improve this?  bjm */
  into_clause:  INTO OptTempTableName        { $$ = $2; }
!         | /*EMPTY*/                        { $$ = lcons(makeInteger(FALSE), NIL); }
          ;

  /*
--- 3383,3389 ----

          /* easy way to return two values. Can someone improve this?  bjm */
  into_clause:  INTO OptTempTableName        { $$ = $2; }
!         | /*EMPTY*/                        { $$ = makeList1(makeInteger(FALSE)); }
          ;

  /*
Index: backend/parser/parse_coerce.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/parse_coerce.c,v
retrieving revision 2.52
retrieving revision 2.53
diff -c -r2.52 -r2.53
*** backend/parser/parse_coerce.c    2000/12/17 04:32:29    2.52
--- backend/parser/parse_coerce.c    2001/01/17 17:26:45    2.53
***************
*** 8,14 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.52 2000/12/17 04:32:29 tgl
Exp$ 
   *
   *-------------------------------------------------------------------------
   */
--- 8,14 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.53 2001/01/17 17:26:45
momjianExp $ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 128,134 ****
          FuncCall   *n = makeNode(FuncCall);

          n->funcname = typeidTypeName(targetTypeId);
!         n->args = lcons(node, NIL);
          n->agg_star = false;
          n->agg_distinct = false;

--- 128,134 ----
          FuncCall   *n = makeNode(FuncCall);

          n->funcname = typeidTypeName(targetTypeId);
!         n->args = makeList1(node);
          n->agg_star = false;
          n->agg_distinct = false;

***************
*** 304,310 ****
          cons->val.val.ival = atttypmod;

          func->funcname = funcname;
!         func->args = lappend(lcons(node, NIL), cons);
          func->agg_star = false;
          func->agg_distinct = false;

--- 304,310 ----
          cons->val.val.ival = atttypmod;

          func->funcname = funcname;
!         func->args = makeList2(node, cons);
          func->agg_star = false;
          func->agg_distinct = false;

Index: backend/utils/adt/datetime.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/datetime.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -c -r1.57 -r1.58
*** backend/utils/adt/datetime.c    2000/12/03 20:45:35    1.57
--- backend/utils/adt/datetime.c    2001/01/17 16:46:56    1.58
***************
*** 8,14 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.57 2000/12/03 20:45:35 tgl
Exp$ 
   *
   *-------------------------------------------------------------------------
   */
--- 8,14 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.58 2001/01/17 16:46:56
thomasExp $ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 2229,2249 ****
                  sprintf(cp, "%d year%s",
                          tm->tm_year, ((tm->tm_year != 1) ? "s" : ""));
                  cp += strlen(cp);
                  is_nonzero = TRUE;
              }

              if (tm->tm_mon != 0)
              {
!                 sprintf(cp, "%s%d mon%s", (is_nonzero ? " " : ""),
                          tm->tm_mon, ((tm->tm_mon != 1) ? "s" : ""));
                  cp += strlen(cp);
                  is_nonzero = TRUE;
              }

              if (tm->tm_mday != 0)
              {
!                 sprintf(cp, "%s%d", (is_nonzero ? " " : ""), tm->tm_mday);
                  cp += strlen(cp);
                  is_nonzero = TRUE;
              }
              {
--- 2229,2255 ----
                  sprintf(cp, "%d year%s",
                          tm->tm_year, ((tm->tm_year != 1) ? "s" : ""));
                  cp += strlen(cp);
+                 is_before = (tm->tm_year < 0);
                  is_nonzero = TRUE;
              }

              if (tm->tm_mon != 0)
              {
!                 sprintf(cp, "%s%s%d mon%s", (is_nonzero ? " " : ""),
!                         ((is_before && (tm->tm_mon > 0)) ? "+" : ""),
                          tm->tm_mon, ((tm->tm_mon != 1) ? "s" : ""));
                  cp += strlen(cp);
+                 is_before = (tm->tm_mon < 0);
                  is_nonzero = TRUE;
              }

              if (tm->tm_mday != 0)
              {
!                 sprintf(cp, "%s%s%d day%s", (is_nonzero ? " " : ""),
!                         ((is_before && (tm->tm_mday > 0)) ? "+" : ""),
!                         tm->tm_mday, ((tm->tm_mday != 1) ? "s" : ""));
                  cp += strlen(cp);
+                 is_before = (tm->tm_mday < 0);
                  is_nonzero = TRUE;
              }
              {
***************
*** 2251,2257 ****
                               || (tm->tm_sec < 0) || (fsec < 0));

                  sprintf(cp, "%s%s%02d:%02d", (is_nonzero ? " " : ""),
!                         (minus ? "-" : "+"),
                          abs(tm->tm_hour), abs(tm->tm_min));
                  cp += strlen(cp);
                  /* Mark as "non-zero" since the fields are now filled in */
--- 2257,2263 ----
                               || (tm->tm_sec < 0) || (fsec < 0));

                  sprintf(cp, "%s%s%02d:%02d", (is_nonzero ? " " : ""),
!                         (minus ? "-" : (is_nonzero ? "+" : "")),
                          abs(tm->tm_hour), abs(tm->tm_min));
                  cp += strlen(cp);
                  /* Mark as "non-zero" since the fields are now filled in */
***************
*** 2283,2341 ****

              if (tm->tm_year != 0)
              {
!                 is_before = (tm->tm_year < 0);
!                 if (is_before)
!                     tm->tm_year = -tm->tm_year;
!                 sprintf(cp, "%d year%s",
!                         tm->tm_year, ((tm->tm_year != 1) ? "s" : ""));
                  cp += strlen(cp);
                  is_nonzero = TRUE;
              }

              if (tm->tm_mon != 0)
              {
                  if (! is_nonzero)
                      is_before = (tm->tm_mon < 0);
-                 if (is_before)
-                     tm->tm_mon = -tm->tm_mon;
-                 sprintf(cp, "%s%d mon%s", (is_nonzero ? " " : ""),
-                         tm->tm_mon, ((tm->tm_mon != 1) ? "s" : ""));
-                 cp += strlen(cp);
                  is_nonzero = TRUE;
              }

              if (tm->tm_mday != 0)
              {
                  if (! is_nonzero)
                      is_before = (tm->tm_mday < 0);
-                 if (is_before)
-                     tm->tm_mday = -tm->tm_mday;
-                 sprintf(cp, "%s%d day%s", (is_nonzero ? " " : ""),
-                  tm->tm_mday, ((tm->tm_mday != 1) ? "s" : ""));
-                 cp += strlen(cp);
                  is_nonzero = TRUE;
              }
              if (tm->tm_hour != 0)
              {
                  if (! is_nonzero)
                      is_before = (tm->tm_hour < 0);
-                 if (is_before)
-                     tm->tm_hour = -tm->tm_hour;
-                 sprintf(cp, "%s%d hour%s", (is_nonzero ? " " : ""),
-                  tm->tm_hour, ((tm->tm_hour != 1) ? "s" : ""));
-                 cp += strlen(cp);
                  is_nonzero = TRUE;
              }

              if (tm->tm_min != 0)
              {
                  if (! is_nonzero)
                      is_before = (tm->tm_min < 0);
-                 if (is_before)
-                     tm->tm_min = -tm->tm_min;
-                 sprintf(cp, "%s%d min%s", (is_nonzero ? " " : ""),
-                    tm->tm_min, ((tm->tm_min != 1) ? "s" : ""));
-                 cp += strlen(cp);
                  is_nonzero = TRUE;
              }

--- 2289,2347 ----

              if (tm->tm_year != 0)
              {
!                 int year = ((tm->tm_year < 0) ? -(tm->tm_year) : tm->tm_year);
!
!                 sprintf(cp, "%d year%s", year,
!                         ((year != 1) ? "s" : ""));
                  cp += strlen(cp);
+                 is_before = (tm->tm_year < 0);
                  is_nonzero = TRUE;
              }

              if (tm->tm_mon != 0)
              {
+                 int mon = ((is_before && (tm->tm_mon > 0)) ? -(tm->tm_mon) : tm->tm_mon);
+
+                 sprintf(cp, "%s%d mon%s", (is_nonzero ? " " : ""), mon,
+                         ((mon != 1) ? "s" : ""));
+                 cp += strlen(cp);
                  if (! is_nonzero)
                      is_before = (tm->tm_mon < 0);
                  is_nonzero = TRUE;
              }

              if (tm->tm_mday != 0)
              {
+                 int day = ((is_before && (tm->tm_mday > 0)) ? -(tm->tm_mday) : tm->tm_mday);
+
+                 sprintf(cp, "%s%d day%s", (is_nonzero ? " " : ""), day,
+                         ((day != 1) ? "s" : ""));
+                 cp += strlen(cp);
                  if (! is_nonzero)
                      is_before = (tm->tm_mday < 0);
                  is_nonzero = TRUE;
              }
              if (tm->tm_hour != 0)
              {
+                 int hour = ((is_before && (tm->tm_hour > 0)) ? -(tm->tm_hour) : tm->tm_hour);
+
+                 sprintf(cp, "%s%d hour%s", (is_nonzero ? " " : ""), hour,
+                         ((hour != 1) ? "s" : ""));
+                 cp += strlen(cp);
                  if (! is_nonzero)
                      is_before = (tm->tm_hour < 0);
                  is_nonzero = TRUE;
              }

              if (tm->tm_min != 0)
              {
+                 int min = ((is_before && (tm->tm_min > 0)) ? -(tm->tm_min) : tm->tm_min);
+
+                 sprintf(cp, "%s%d min%s", (is_nonzero ? " " : ""), min,
+                         ((min != 1) ? "s" : ""));
+                 cp += strlen(cp);
                  if (! is_nonzero)
                      is_before = (tm->tm_min < 0);
                  is_nonzero = TRUE;
              }

***************
*** 2343,2367 ****
              if (fsec != 0)
              {
                  fsec += tm->tm_sec;
                  if (! is_nonzero)
                      is_before = (fsec < 0);
-                 if (is_before)
-                     fsec = -fsec;
-                 sprintf(cp, "%s%.2f secs", (is_nonzero ? " " : ""), fsec);
-                 cp += strlen(cp);
                  is_nonzero = TRUE;

                  /* otherwise, integer seconds only? */
              }
              else if (tm->tm_sec != 0)
              {
                  if (! is_nonzero)
                      is_before = (tm->tm_sec < 0);
-                 if (is_before)
-                     tm->tm_sec = -tm->tm_sec;
-                 sprintf(cp, "%s%d sec%s", (is_nonzero ? " " : ""),
-                    tm->tm_sec, ((tm->tm_sec != 1) ? "s" : ""));
-                 cp += strlen(cp);
                  is_nonzero = TRUE;
              }
              break;
--- 2349,2372 ----
              if (fsec != 0)
              {
                  fsec += tm->tm_sec;
+                 sprintf(cp, "%s%.2f secs", (is_nonzero ? " " : ""),
+                         ((is_before && (fsec > 0)) ? -(fsec) : fsec));
+                 cp += strlen(cp);
                  if (! is_nonzero)
                      is_before = (fsec < 0);
                  is_nonzero = TRUE;

                  /* otherwise, integer seconds only? */
              }
              else if (tm->tm_sec != 0)
              {
+                 int sec = ((is_before && (tm->tm_sec > 0)) ? -(tm->tm_sec) : tm->tm_sec);
+
+                 sprintf(cp, "%s%d sec%s", (is_nonzero ? " " : ""), sec,
+                         ((sec != 1) ? "s" : ""));
+                 cp += strlen(cp);
                  if (! is_nonzero)
                      is_before = (tm->tm_sec < 0);
                  is_nonzero = TRUE;
              }
              break;
***************
*** 2374,2380 ****
          cp += strlen(cp);
      }

!     if (is_before)
      {
          strcat(cp, " ago");
          cp += strlen(cp);
--- 2379,2385 ----
          cp += strlen(cp);
      }

!     if (is_before && (style == USE_POSTGRES_DATES))
      {
          strcat(cp, " ago");
          cp += strlen(cp);
Index: backend/utils/adt/formatting.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/formatting.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -c -r1.28 -r1.29
*** backend/utils/adt/formatting.c    2000/12/23 04:05:31    1.28
--- backend/utils/adt/formatting.c    2001/01/17 16:46:56    1.29
***************
*** 1,7 ****
  /* -----------------------------------------------------------------------
   * formatting.c
   *
!  * $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.28 2000/12/23 04:05:31 tgl Exp
$
   *
   *
   *     Portions Copyright (c) 1999-2000, PostgreSQL, Inc
--- 1,7 ----
  /* -----------------------------------------------------------------------
   * formatting.c
   *
!  * $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.29 2001/01/17 16:46:56 thomas
Exp$ 
   *
   *
   *     Portions Copyright (c) 1999-2000, PostgreSQL, Inc
***************
*** 382,388 ****
          elog(DEBUG_elog_output, "TM:\nsec %d\nyear %d\nmin %d\nwday %d\nhour %d\nyday %d\nmday %d\nnisdst %d\nmon
%d\n",\
              tm->tm_sec, tm->tm_year,\
              tm->tm_min, tm->tm_wday, tm->tm_hour, tm->tm_yday,\
!             tm->tm_mday, tm->tm_isdst,tm->tm_mon)
  #endif

  #define ZERO_tm( _X ) \
--- 382,388 ----
          elog(DEBUG_elog_output, "TM:\nsec %d\nyear %d\nmin %d\nwday %d\nhour %d\nyday %d\nmday %d\nnisdst %d\nmon
%d\n",\
              tm->tm_sec, tm->tm_year,\
              tm->tm_min, tm->tm_wday, tm->tm_hour, tm->tm_yday,\
!             tm->tm_mday, tm->tm_isdst, tm->tm_mon)
  #endif

  #define ZERO_tm( _X ) \
***************
*** 2933,2941 ****
  # elif defined(HAVE_INT_TIMEZONE)

  #  ifdef __CYGWIN__
!         tz = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
  #  else
!         tz = (tm->tm_isdst ? (timezone - 3600) : timezone);
  #  endif

  # endif
--- 2933,2941 ----
  # elif defined(HAVE_INT_TIMEZONE)

  #  ifdef __CYGWIN__
!         tz = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
  #  else
!         tz = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
  #  endif

  # endif
Index: backend/utils/adt/nabstime.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -c -r1.77 -r1.78
*** backend/utils/adt/nabstime.c    2000/12/09 20:40:57    1.77
--- backend/utils/adt/nabstime.c    2001/01/17 16:46:56    1.78
***************
*** 9,15 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.77 2000/12/09 20:40:57 tgl
Exp$ 
   *
   * NOTES
   *
--- 9,15 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.78 2001/01/17 16:46:56
thomasExp $ 
   *
   * NOTES
   *
***************
*** 162,170 ****
          CDayLight = tm->tm_isdst;
          CTimeZone =
  # ifdef __CYGWIN__
!             (tm->tm_isdst ? (_timezone - 3600) : _timezone);
  # else
!             (tm->tm_isdst ? (timezone - 3600) : timezone);
  # endif
          strcpy(CTZName, tzname[tm->tm_isdst]);
  #else /* neither HAVE_TM_ZONE nor HAVE_INT_TIMEZONE */
--- 162,170 ----
          CDayLight = tm->tm_isdst;
          CTimeZone =
  # ifdef __CYGWIN__
!             ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
  # else
!             ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
  # endif
          strcpy(CTZName, tzname[tm->tm_isdst]);
  #else /* neither HAVE_TM_ZONE nor HAVE_INT_TIMEZONE */
***************
*** 245,253 ****
  # elif defined(HAVE_INT_TIMEZONE)
      if (tzp != NULL)
  #  ifdef __CYGWIN__
!         *tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
  #  else
!         *tzp = (tm->tm_isdst ? (timezone - 3600) : timezone);
  #  endif
      if (tzn != NULL)
      {
--- 245,253 ----
  # elif defined(HAVE_INT_TIMEZONE)
      if (tzp != NULL)
  #  ifdef __CYGWIN__
!         *tzp = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
  #  else
!         *tzp = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
  #  endif
      if (tzn != NULL)
      {
Index: backend/utils/adt/timestamp.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -c -r1.41 -r1.42
*** backend/utils/adt/timestamp.c    2001/01/03 16:48:02    1.41
--- backend/utils/adt/timestamp.c    2001/01/17 16:46:56    1.42
***************
*** 8,14 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.41 2001/01/03 16:48:02
thomasExp $ 
   *
   *-------------------------------------------------------------------------
   */
--- 8,14 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.42 2001/01/17 16:46:56
thomasExp $ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 341,349 ****
                  *tzn = (char *) tm->tm_zone;
  # elif defined(HAVE_INT_TIMEZONE)
  #  ifdef __CYGWIN__
!             *tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
  #  else
!             *tzp = (tm->tm_isdst ? (timezone - 3600) : timezone);
  #  endif
              if (tzn != NULL)
                  *tzn = tzname[(tm->tm_isdst > 0)];
--- 341,349 ----
                  *tzn = (char *) tm->tm_zone;
  # elif defined(HAVE_INT_TIMEZONE)
  #  ifdef __CYGWIN__
!             *tzp = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
  #  else
!             *tzp = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
  #  endif
              if (tzn != NULL)
                  *tzn = tzname[(tm->tm_isdst > 0)];
***************
*** 1086,1094 ****
  # elif defined(HAVE_INT_TIMEZONE)

  #  ifdef __CYGWIN__
!                     tz = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
  #  else
!                     tz = (tm->tm_isdst ? (timezone - 3600) : timezone);
  #  endif

  # endif
--- 1086,1094 ----
  # elif defined(HAVE_INT_TIMEZONE)

  #  ifdef __CYGWIN__
!                     tz = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
  #  else
!                     tz = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
  #  endif

  # endif
***************
*** 1735,1743 ****
  # elif defined(HAVE_INT_TIMEZONE)

  #  ifdef __CYGWIN__
!                 tz = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
  #  else
!                 tz = (tm->tm_isdst ? (timezone - 3600) : timezone);
  #  endif

  # endif
--- 1735,1743 ----
  # elif defined(HAVE_INT_TIMEZONE)

  #  ifdef __CYGWIN__
!                 tz = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
  #  else
!                 tz = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
  #  endif

  # endif
Index: include/nodes/primnodes.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/nodes/primnodes.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -c -r1.49 -r1.50
*** include/nodes/primnodes.h    2000/09/29 18:21:39    1.49
--- include/nodes/primnodes.h    2001/01/17 06:41:31    1.50
***************
*** 10,16 ****
   * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  * $Id: primnodes.h,v 1.49 2000/09/29 18:21:39 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 10,16 ----
   * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
   * Portions Copyright (c) 1994, Regents of the University of California
   *
!  * $Id: primnodes.h,v 1.50 2001/01/17 06:41:31 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
***************
*** 29,45 ****
   * ----------------------------------------------------------------
   */

! /* ----------------
   * Resdom (Result Domain)
-  *        resno            - attribute number
-  *        restype            - type of the value
-  *        restypmod        - type-specific modifier of the value
-  *        resname            - name of the resdom (could be NULL)
-  *        ressortgroupref - nonzero if referenced by a sort/group clause
-  *        reskey            - order of key in a sort (for those > 0)
-  *        reskeyop        - sort operator's regproc Oid
-  *        resjunk            - set to true to eliminate the attribute
-  *                          from final target list
   *
   * Notes:
   * ressortgroupref is the parse/plan-time representation of ORDER BY and
--- 29,36 ----
   * ----------------------------------------------------------------
   */

! /*
   * Resdom (Result Domain)
   *
   * Notes:
   * ressortgroupref is the parse/plan-time representation of ORDER BY and
***************
*** 59,104 ****
   *
   * Both reskey and reskeyop are typically zero during parse/plan stages.
   * The executor does not pay any attention to ressortgroupref.
!  * ----------------
   */
  typedef struct Resdom
  {
!     NodeTag        type;
!     AttrNumber    resno;
!     Oid            restype;
!     int32        restypmod;
!     char       *resname;
      Index        ressortgroupref;
!     Index        reskey;
!     Oid            reskeyop;
!     bool        resjunk;
  } Resdom;

! /* -------------
   * Fjoin
-  *        initialized        - true if the Fjoin has already been initialized for
-  *                          the current target list evaluation
-  *        nNodes            - The number of Iter nodes returning sets that the
-  *                          node will flatten
-  *        outerList        - 1 or more Iter nodes
-  *        inner            - exactly one Iter node.  We eval every node in the
-  *                          outerList once then eval the inner node to completion
-  *                          pair the outerList result vector with each inner
-  *                          result to form the full result.  When the inner has
-  *                          been exhausted, we get the next outer result vector
-  *                          and reset the inner.
-  *        results            - The complete (flattened) result vector
-  *        alwaysNull        - a null vector to indicate sets with a cardinality of
-  *                          0, we treat them as the set {NULL}.
   */
  typedef struct Fjoin
  {
      NodeTag        type;
!     bool        fj_initialized;
!     int            fj_nNodes;
!     List       *fj_innerNode;
!     DatumPtr    fj_results;
!     BoolPtr        fj_alwaysDone;
  } Fjoin;


--- 50,97 ----
   *
   * Both reskey and reskeyop are typically zero during parse/plan stages.
   * The executor does not pay any attention to ressortgroupref.
!  *
   */
  typedef struct Resdom
  {
!     NodeTag        type;
!     AttrNumber    resno;        /* attribute number */
!     Oid            restype;    /* type of the value */
!     int32        restypmod;    /* type-specific modifier of the value */
!     char       *resname;    /* name of the resdom (could be NULL) */
      Index        ressortgroupref;
!                             /* nonzero if referenced by a sort/group clause */
!     Index        reskey;        /* order of key in a sort (for those > 0) */
!     Oid            reskeyop;    /* sort operator's regproc Oid */
!     bool        resjunk;    /* set to true to eliminate the attribute
!  *                               from final target list */
  } Resdom;

! /*
   * Fjoin
   */
  typedef struct Fjoin
  {
      NodeTag        type;
!     bool        fj_initialized;    /* true if the Fjoin has already been
!                                  * initialized for the current target
!                                  * list evaluation */
!     int            fj_nNodes;        /* The number of Iter nodes returning
!                                  * sets that the node will flatten */
!     List       *fj_innerNode;    /* exactly one Iter node.  We eval every
!                                  * node in the outerList once then eval
!                                  * the inner node to completion pair the
!                                  * outerList result vector with each inner
!                                  * result to form the full result.  When
!                                  * the inner has been exhausted, we get
!                                  * the next outer result vector and reset
!                                  * the inner.
!                                  */
!     DatumPtr    fj_results;        /* The complete (flattened) result vector */
!     BoolPtr        fj_alwaysDone;    /* a null vector to indicate sets with a
!                                  * cardinality of 0, we treat them as the
!                                  * set {NULL}.
!                                  */
  } Fjoin;


***************
*** 107,119 ****
   * ----------------------------------------------------------------
   */

! /* ----------------
   * Expr
-  *        typeOid            - oid of the type of this expression
-  *        opType            - type of this expression
-  *        oper            - operator node if needed (Oper, Func, or SubPlan)
-  *        args            - arguments to this expression
-  * ----------------
   */
  typedef enum OpType
  {
--- 100,107 ----
   * ----------------------------------------------------------------
   */

! /*
   * Expr
   */
  typedef enum OpType
  {
***************
*** 123,145 ****
  typedef struct Expr
  {
      NodeTag        type;
!     Oid            typeOid;        /* oid of the type of this expr */
!     OpType        opType;            /* type of the op */
!     Node       *oper;            /* could be Oper or Func or SubPlan */
!     List       *args;            /* list of argument nodes */
  } Expr;

! /* ----------------
   * Var
-  *        varno            - index of this var's relation in the range table
-  *                          (could also be INNER or OUTER)
-  *        varattno        - attribute number of this var, or zero for all
-  *        vartype            - pg_type tuple OID for the type of this var
-  *        vartypmod        - pg_attribute typmod value
-  *        varlevelsup        - for subquery variables referencing outer relations;
-  *                          0 in a normal var, >0 means N levels up
-  *        varnoold        - original value of varno
-  *        varoattno        - original value of varattno
   *
   * Note: during parsing/planning, varnoold/varoattno are always just copies
   * of varno/varattno.  At the tail end of planning, Var nodes appearing in
--- 111,125 ----
  typedef struct Expr
  {
      NodeTag        type;
!     Oid            typeOid;    /* oid of the type of this expression */
!     OpType        opType;        /* type of this expression */
!     Node       *oper;        /* operator node if needed (Oper, Func, or
!                              * SubPlan) */
!     List       *args;        /* arguments to this expression */
  } Expr;

! /*
   * Var
   *
   * Note: during parsing/planning, varnoold/varoattno are always just copies
   * of varno/varattno.  At the tail end of planning, Var nodes appearing in
***************
*** 160,182 ****
  typedef struct Var
  {
      NodeTag        type;
!     Index        varno;
!     AttrNumber    varattno;
!     Oid            vartype;
!     int32        vartypmod;
      Index        varlevelsup;
!     Index        varnoold;        /* mainly for debugging --- see above */
!     AttrNumber    varoattno;
  } Var;

! /* ----------------
   * Oper
-  *        opno            - PG_OPERATOR OID of the operator
-  *        opid            - PG_PROC OID for the operator's underlying function
-  *        opresulttype    - PG_TYPE OID of the operator's return value
-  *        op_fcache        - runtime state while running the function
   *
-  * ----
   * NOTE: in the good old days 'opno' used to be both (or either, or
   * neither) the pg_operator oid, and/or the pg_proc oid depending
   * on the postgres module in question (parser->pg_operator,
--- 140,161 ----
  typedef struct Var
  {
      NodeTag        type;
!     Index        varno;        /* index of this var's relation in the range
!                              * table (could also be INNER or OUTER) */
!     AttrNumber    varattno;    /* attribute number of this var, or zero for all */
!     Oid            vartype;    /* pg_type tuple OID for the type of this var */
!     int32        vartypmod;    /* pg_attribute typmod value */
      Index        varlevelsup;
!                             /* for subquery variables referencing outer
!                              * relations; 0 in a normal var, >0 means N
!                              * levels up */
!     Index        varnoold;    /* original value of varno, for debugging */
!     AttrNumber    varoattno;    /* original value of varattno */
  } Var;

! /*
   * Oper
   *
   * NOTE: in the good old days 'opno' used to be both (or either, or
   * neither) the pg_operator oid, and/or the pg_proc oid depending
   * on the postgres module in question (parser->pg_operator,
***************
*** 190,232 ****
   * Note also that opid is not necessarily filled in immediately on creation
   * of the node.  The planner makes sure it is valid before passing the node
   * tree to the executor, but during parsing/planning opid is typically 0.
!  * ----------------
   */
  typedef struct Oper
  {
      NodeTag        type;
!     Oid            opno;
!     Oid            opid;
      Oid            opresulttype;
      FunctionCachePtr op_fcache;
  } Oper;


! /* ----------------
   * Const
-  *        consttype - PG_TYPE OID of the constant's value
-  *        constlen - length in bytes of the constant's value
-  *        constvalue - the constant's value
-  *        constisnull - whether the constant is null
-  *                (if true, the other fields are undefined)
-  *        constbyval - whether the information in constvalue
-  *                if passed by value.  If true, then all the information
-  *                is stored in the datum. If false, then the datum
-  *                contains a pointer to the information.
-  *        constisset - whether the const represents a set.  The const
-  *                value corresponding will be the query that defines
-  *                the set.
-  * ----------------
   */
  typedef struct Const
  {
      NodeTag        type;
!     Oid            consttype;
!     int            constlen;
!     Datum        constvalue;
!     bool        constisnull;
!     bool        constbyval;
!     bool        constisset;
      bool        constiscast;
  } Const;

--- 169,208 ----
   * Note also that opid is not necessarily filled in immediately on creation
   * of the node.  The planner makes sure it is valid before passing the node
   * tree to the executor, but during parsing/planning opid is typically 0.
!  *
   */
  typedef struct Oper
  {
      NodeTag        type;
!     Oid            opno;        /* PG_OPERATOR OID of the operator */
!     Oid            opid;        /* PG_PROC OID for the operator's underlying
!                              * function */
      Oid            opresulttype;
+                             /* PG_TYPE OID of the operator's return value */
      FunctionCachePtr op_fcache;
+                             /* runtime state while running the function */
  } Oper;


! /*
   * Const
   */
  typedef struct Const
  {
      NodeTag        type;
!     Oid            consttype;        /* PG_TYPE OID of the constant's value */
!     int            constlen;        /* length in bytes of the constant's value */
!     Datum        constvalue;        /* the constant's value */
!     bool        constisnull;    /* whether the constant is null (if true,
!                                  * the other fields are undefined) */
!     bool        constbyval;        /* whether the information in constvalue
!                                  * if passed by value.  If true, then all
!                                  * the information is stored in the datum.
!                                  * If false, then the datum contains a pointer
!                                  * to the information. */
!     bool        constisset;        /* whether the const represents a set.
!                                  * The const value corresponding will be the
!                                  * query that defines the set. */
      bool        constiscast;
  } Const;

***************
*** 250,287 ****
   *
   *        PARAM_OLD:     Same as PARAM_NEW, but in this case we refer to
   *                the "OLD" tuple.
-  *
-  *        paramid - numeric identifier for literal-constant parameters ("$1")
-  *        paramname - attribute name for tuple-substitution parameters ("$.foo")
-  *        paramtype - PG_TYPE OID of the parameter's value
   * ----------------
   */
  typedef struct Param
  {
      NodeTag        type;
!     int            paramkind;
!     AttrNumber    paramid;
!     char       *paramname;
!     Oid            paramtype;
  } Param;


! /* ----------------
   * Func
-  *        funcid            - PG_PROC OID of the function
-  *        functype        - PG_TYPE OID of the function's return value
-  *        func_fcache        - runtime state while running this function.  Where
-  *                          we are in the execution of the function if it
-  *                          returns more than one value, etc.
-  *                          See utils/fcache.h
-  * ----------------
   */
  typedef struct Func
  {
      NodeTag        type;
!     Oid            funcid;
!     Oid            functype;
      FunctionCachePtr func_fcache;
  } Func;

  /* ----------------
--- 226,258 ----
   *
   *        PARAM_OLD:     Same as PARAM_NEW, but in this case we refer to
   *                the "OLD" tuple.
   * ----------------
   */
  typedef struct Param
  {
      NodeTag        type;
!     int            paramkind;    /* specifies the kind of parameter.  See above */
!     AttrNumber    paramid;    /* numeric identifier for literal-constant
!                              * parameters ("$1") */
!     char       *paramname;    /* attribute name for tuple-substitution
!                              * parameters ("$.foo") */
!     Oid            paramtype;    /* PG_TYPE OID of the parameter's value */
  } Param;


! /*
   * Func
   */
  typedef struct Func
  {
      NodeTag        type;
!     Oid            funcid;        /* PG_PROC OID of the function */
!     Oid            functype;    /* PG_TYPE OID of the function's return value */
      FunctionCachePtr func_fcache;
+                             /* runtime state while running this function.
+                              * Where we are in the execution of the function
+                              * if it returns more than one value, etc.
+                              * See utils/fcache.h */
  } Func;

  /* ----------------
***************
*** 298,333 ****
                                   * checking) */
  } Iter;

! /* ----------------
   * Aggref
-  *        aggname            - name of the aggregate
-  *        basetype        - base type Oid of the aggregate (ie, input type)
-  *        aggtype            - type Oid of final result of the aggregate
-  *        target            - attribute or expression we are aggregating on
-  *        aggstar            - TRUE if argument was really '*'
-  *        aggdistinct        - TRUE if it's agg(DISTINCT ...)
-  *        aggno            - workspace for executor (see nodeAgg.c)
-  * ----------------
   */
  typedef struct Aggref
  {
      NodeTag        type;
!     char       *aggname;
!     Oid            basetype;
!     Oid            aggtype;
!     Node       *target;
!     bool        aggstar;
!     bool        aggdistinct;
!     int            aggno;
  } Aggref;

  /* ----------------
   * SubLink
-  *        subLinkType        - EXISTS, ALL, ANY, MULTIEXPR, EXPR
-  *        useor            - TRUE to combine column results with "OR" not "AND"
-  *        lefthand        - list of outer-query expressions on the left
-  *        oper            - list of Oper nodes for combining operators
-  *        subselect        - subselect as Query* or parsetree
   *
   * A SubLink represents a subselect appearing in an expression, and in some
   * cases also the combining operator(s) just above it.    The subLinkType
--- 269,292 ----
                                   * checking) */
  } Iter;

! /*
   * Aggref
   */
  typedef struct Aggref
  {
      NodeTag        type;
!     char       *aggname;    /* name of the aggregate */
!     Oid            basetype;    /* base type Oid of the aggregate
!                              * (ie, input type) */
!     Oid            aggtype;    /* type Oid of final result of the aggregate */
!     Node       *target;        /* attribute or expression we are aggregating on */
!     bool        aggstar;    /* TRUE if argument was really '*' */
!     bool        aggdistinct;/* TRUE if it's agg(DISTINCT ...) */
!     int            aggno;        /* workspace for executor (see nodeAgg.c) */
  } Aggref;

  /* ----------------
   * SubLink
   *
   * A SubLink represents a subselect appearing in an expression, and in some
   * cases also the combining operator(s) just above it.    The subLinkType
***************
*** 385,395 ****
  typedef struct SubLink
  {
      NodeTag        type;
!     SubLinkType subLinkType;
!     bool        useor;
!     List       *lefthand;
!     List       *oper;
!     Node       *subselect;
  } SubLink;

  /* ----------------
--- 344,355 ----
  typedef struct SubLink
  {
      NodeTag        type;
!     SubLinkType subLinkType;/* EXISTS, ALL, ANY, MULTIEXPR, EXPR */
!     bool        useor;        /* TRUE to combine column results with "OR"
!                              * not "AND" */
!     List       *lefthand;    /* list of outer-query expressions on the left */
!     List       *oper;        /* list of Oper nodes for combining operators */
!     Node       *subselect;    /* subselect as Query* or parsetree */
  } SubLink;

  /* ----------------
***************
*** 402,416 ****
   * appropriate part of the array; the result of the operation is an
   * entire new modified array value.
   *
-  *        refattrlength    - typlen of array type
-  *        refelemtype        - type of the result of the ArrayRef operation
-  *        refelemlength    - typlen of the array element type
-  *        refelembyval    - is the element type pass-by-value?
-  *        refupperindexpr - expressions that evaluate to upper array indexes
-  *        reflowerindexpr - expressions that evaluate to lower array indexes
-  *        refexpr            - the expression that evaluates to an array value
-  *        refassgnexpr    - expression for the source value, or NULL if fetch
-  *
   * If reflowerindexpr = NIL, then we are fetching or storing a single array
   * element at the subscripts given by refupperindexpr.    Otherwise we are
   * fetching or storing an array slice, that is a rectangular subarray
--- 362,367 ----
***************
*** 432,453 ****
  typedef struct ArrayRef
  {
      NodeTag        type;
!     int            refattrlength;
!     int            refelemlength;
!     Oid            refelemtype;
!     bool        refelembyval;
!     List       *refupperindexpr;
!     List       *reflowerindexpr;
!     Node       *refexpr;
!     Node       *refassgnexpr;
  } ArrayRef;

  /* ----------------
   * FieldSelect
-  *        arg                - input expression
-  *        fieldnum        - attribute number of field to extract
-  *        resulttype        - type of the field (result type of this node)
-  *        resulttypmod    - output typmod (usually -1)
   *
   * FieldSelect represents the operation of extracting one field from a tuple
   * value.  At runtime, the input expression is expected to yield a Datum
--- 383,405 ----
  typedef struct ArrayRef
  {
      NodeTag        type;
!     int            refattrlength;        /* typlen of array type */
!     int            refelemlength;        /* typlen of the array element type */
!     Oid            refelemtype;        /* type of the result of the ArrayRef
!                                       * operation */
!     bool        refelembyval;        /* is the element type pass-by-value? */
!     List       *refupperindexpr;    /* expressions that evaluate to upper
!                                       * array indexes */
!     List       *reflowerindexpr;    /* expressions that evaluate to lower
!                                       * array indexes */
!     Node       *refexpr;            /* the expression that evaluates to an
!                                      * array value */
!     Node       *refassgnexpr;        /* expression for the source value, or NULL
!                                       * if fetch */
  } ArrayRef;

  /* ----------------
   * FieldSelect
   *
   * FieldSelect represents the operation of extracting one field from a tuple
   * value.  At runtime, the input expression is expected to yield a Datum
***************
*** 459,475 ****
  typedef struct FieldSelect
  {
      NodeTag        type;
!     Node       *arg;
!     AttrNumber    fieldnum;
!     Oid            resulttype;
!     int32        resulttypmod;
  } FieldSelect;

  /* ----------------
   * RelabelType
-  *        arg                - input expression
-  *        resulttype        - output type of coercion expression
-  *        resulttypmod    - output typmod (usually -1)
   *
   * RelabelType represents a "dummy" type coercion between two binary-
   * compatible datatypes, such as reinterpreting the result of an OID
--- 411,425 ----
  typedef struct FieldSelect
  {
      NodeTag        type;
!     Node       *arg;            /* input expression */
!     AttrNumber    fieldnum;        /* attribute number of field to extract */
!     Oid            resulttype;        /* type of the field (result type of this
!                                  * node) */
!     int32        resulttypmod;    /* output typmod (usually -1) */
  } FieldSelect;

  /* ----------------
   * RelabelType
   *
   * RelabelType represents a "dummy" type coercion between two binary-
   * compatible datatypes, such as reinterpreting the result of an OID
***************
*** 484,492 ****
  typedef struct RelabelType
  {
      NodeTag        type;
!     Node       *arg;
!     Oid            resulttype;
!     int32        resulttypmod;
  } RelabelType;


--- 434,442 ----
  typedef struct RelabelType
  {
      NodeTag        type;
!     Node       *arg;            /* input expression */
!     Oid            resulttype;        /* output type of coercion expression */
!     int32        resulttypmod;    /* output typmod (usually -1) */
  } RelabelType;



pgsql-patches by date:

Previous
From: Gunnar R|nning
Date:
Subject: Re: Fixes and enhancements to JDBC driver (take 2)
Next
From: Bruce Momjian
Date:
Subject: your JDBC patch