Re: BUG #1962: ECPG and VARCHAR - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: BUG #1962: ECPG and VARCHAR
Date
Msg-id 200510140153.j9E1rEB19532@candle.pha.pa.us
Whole thread Raw
In response to Re: BUG #1962: ECPG and VARCHAR  (Michael Fuhr <mike@fuhr.org>)
Responses Re: BUG #1962: ECPG and VARCHAR  (Michael Meskes <meskes@postgresql.org>)
List pgsql-bugs
Michael Fuhr wrote:
> On Thu, Oct 13, 2005 at 09:49:20AM -0600, Michael Fuhr wrote:
> > ecpg in 8.0.4 seems not to like the macros.  I get the same error,
> > but not if I do this:
> >
> >     VARCHAR  t[256];
> >     VARCHAR  o[256];
> >
> > ecpg in 8.1beta3 works either way.
>
> This appears to be the guilty commit, which was made to 7.4, 8.0,
> and HEAD (8.1):
>
> http://archives.postgresql.org/pgsql-committers/2005-08/msg00266.php
>
> It was recently fixed in HEAD only:
>
> http://archives.postgresql.org/pgsql-committers/2005-10/msg00043.php

Good catch!  I have backpatched these fixes to the 8.0 and 7.4 branches
as you suggested, (identical) patches attached.

The big problem is that we might not make releases on these branches for
months, so anyone needing the fix should download CVS for those
branches.

--
  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/interfaces/ecpg/preproc/preproc.y
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/ecpg/preproc/preproc.y,v
retrieving revision 1.303.4.4
diff -c -c -r1.303.4.4 preproc.y
*** src/interfaces/ecpg/preproc/preproc.y    24 Aug 2005 10:35:12 -0000    1.303.4.4
--- src/interfaces/ecpg/preproc/preproc.y    14 Oct 2005 01:47:05 -0000
***************
*** 5142,5149 ****
                              *dim = '\0';
                      else
                              sprintf(dim, "[%s]", dimension);
!                     /* if (strcmp(length, "0") == 0)*/
!                     if (atoi(length) <= 0)
                          mmerror(PARSE_ERROR, ET_ERROR, "pointer to varchar are not implemented");

                      if (strcmp(dimension, "0") == 0)
--- 5142,5149 ----
                              *dim = '\0';
                      else
                              sprintf(dim, "[%s]", dimension);
!                     /* cannot check for atoi <= 0 because a defined constant will yield 0 here as well */
!                     if (atoi(length) < 0 || strcmp(length, "0") == 0)
                          mmerror(PARSE_ERROR, ET_ERROR, "pointer to varchar are not implemented");

                      if (strcmp(dimension, "0") == 0)
Index: src/interfaces/ecpg/preproc/preproc.y
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/ecpg/preproc/preproc.y,v
retrieving revision 1.263.2.20
diff -c -c -r1.263.2.20 preproc.y
*** src/interfaces/ecpg/preproc/preproc.y    24 Aug 2005 10:35:54 -0000    1.263.2.20
--- src/interfaces/ecpg/preproc/preproc.y    14 Oct 2005 01:47:43 -0000
***************
*** 5121,5128 ****
                              *dim = '\0';
                      else
                              sprintf(dim, "[%s]", dimension);
!                     /* if (strcmp(length, "0") == 0)*/
!                     if (atoi(length) <= 0)
                          mmerror(PARSE_ERROR, ET_ERROR, "pointer to varchar are not implemented");

                      if (strcmp(dimension, "0") == 0)
--- 5121,5128 ----
                              *dim = '\0';
                      else
                              sprintf(dim, "[%s]", dimension);
!                     /* cannot check for atoi <= 0 because a defined constant will yield 0 here as well */
!                     if (atoi(length) < 0 || strcmp(length, "0") == 0)
                          mmerror(PARSE_ERROR, ET_ERROR, "pointer to varchar are not implemented");

                      if (strcmp(dimension, "0") == 0)

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #1931: ILIKE and LIKE fails on Turkish locale
Next
From: C Wegrzyn
Date:
Subject: Re: BUG #1962: ECPG and VARCHAR