Re: Sequence patch has problems - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Sequence patch has problems
Date
Msg-id 200303210355.h2L3ttR17041@candle.pha.pa.us
Whole thread Raw
In response to Sequence patch has problems  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Here is the fix, applied.  It was assigning NULL to an int32.  Strange
my compiler didn't complain.

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

Tom Lane wrote:
> I assume these are from the recently-applied sequence patch:
>
> sequence.c: In function `DefineSequence':
> sequence.c:99: warning: assignment makes integer from pointer without a cast
> sequence.c:100: warning: assignment makes integer from pointer without a cast
> sequence.c:101: warning: assignment makes integer from pointer without a cast
> sequence.c:102: warning: assignment makes integer from pointer without a cast
> sequence.c:103: warning: assignment makes integer from pointer without a cast
> sequence.c: In function `init_params':
> sequence.c:882: warning: comparison between pointer and integer
> sequence.c:883: warning: comparison between pointer and integer
> sequence.c:920: warning: comparison between pointer and integer
> sequence.c:931: warning: comparison between pointer and integer
> sequence.c:943: warning: comparison between pointer and integer
> sequence.c:966: warning: comparison between pointer and integer
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/commands/sequence.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/commands/sequence.c,v
retrieving revision 1.94
diff -c -c -r1.94 sequence.c
*** src/backend/commands/sequence.c    20 Mar 2003 07:02:07 -0000    1.94
--- src/backend/commands/sequence.c    21 Mar 2003 03:55:06 -0000
***************
*** 96,106 ****
      NameData    name;

      /* Values are NULL (or false) by default */
!     new.last_value = NULL;
!     new.increment_by = NULL;
!     new.max_value = NULL;
!     new.min_value = NULL;
!     new.cache_value = NULL;
      new.is_cycled = false;

      /* Check and set values */
--- 96,106 ----
      NameData    name;

      /* Values are NULL (or false) by default */
!     new.last_value = 0;
!     new.increment_by = 0;
!     new.max_value = 0;
!     new.min_value = 0;
!     new.cache_value = 0;
      new.is_cycled = false;

      /* Check and set values */
***************
*** 879,886 ****
           * start is for a new sequence
           * restart is for alter
           */
!         else if ((new->last_value == NULL && strcmp(defel->defname, "start") == 0)
!             || (new->last_value != NULL && strcmp(defel->defname, "restart") == 0))
          {
              if (last_value)
                  elog(ERROR, "%s: LAST VALUE defined twice", caller);
--- 879,886 ----
           * start is for a new sequence
           * restart is for alter
           */
!         else if ((new->last_value == 0L && strcmp(defel->defname, "start") == 0)
!             || (new->last_value != 0 && strcmp(defel->defname, "restart") == 0))
          {
              if (last_value)
                  elog(ERROR, "%s: LAST VALUE defined twice", caller);
***************
*** 917,923 ****
      }

      /* INCREMENT BY */
!     if (new->increment_by == NULL && increment_by == (DefElem *) NULL)
          new->increment_by = 1;
      else if (increment_by != (DefElem *) NULL)
      {
--- 917,923 ----
      }

      /* INCREMENT BY */
!     if (new->increment_by == 0 && increment_by == (DefElem *) NULL)
          new->increment_by = 1;
      else if (increment_by != (DefElem *) NULL)
      {
***************
*** 928,934 ****
      }

      /* MAXVALUE */
!     if ((new->max_value == NULL && max_value == (DefElem *) NULL)
          || (max_value != (DefElem *) NULL && !max_value->arg))
      {
          if (new->increment_by > 0)
--- 928,934 ----
      }

      /* MAXVALUE */
!     if ((new->max_value == 0 && max_value == (DefElem *) NULL)
          || (max_value != (DefElem *) NULL && !max_value->arg))
      {
          if (new->increment_by > 0)
***************
*** 940,946 ****
          new->max_value = defGetInt64(max_value);

      /* MINVALUE */
!     if ((new->min_value == NULL && min_value == (DefElem *) NULL)
          || (min_value != (DefElem *) NULL && !min_value->arg))
      {
          if (new->increment_by > 0)
--- 940,946 ----
          new->max_value = defGetInt64(max_value);

      /* MINVALUE */
!     if ((new->min_value == 0 && min_value == (DefElem *) NULL)
          || (min_value != (DefElem *) NULL && !min_value->arg))
      {
          if (new->increment_by > 0)
***************
*** 963,969 ****
      }

      /* START WITH */
!     if (new->last_value == NULL && last_value == (DefElem *) NULL)
      {
          if (new->increment_by > 0)
              new->last_value = new->min_value;    /* ascending seq */
--- 963,969 ----
      }

      /* START WITH */
!     if (new->last_value == 0 && last_value == (DefElem *) NULL)
      {
          if (new->increment_by > 0)
              new->last_value = new->min_value;    /* ascending seq */

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: psql patch
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Add CLUSTER ON to pg_dumps