[ Backpatch to 7.4.X.]
authorBruce Momjian <[email protected]>
Fri, 14 Oct 2005 01:50:58 +0000 (01:50 +0000)
committerBruce Momjian <[email protected]>
Fri, 14 Oct 2005 01:50:58 +0000 (01:50 +0000)
Also I fixed a bug in a bug fix I committed a few weeks ago. he check
for a varchar pointer was incomplete.

Michael Meskes

src/interfaces/ecpg/preproc/preproc.y

index 7d9e07213799a8947140598e205c425f3b9aeef5..b1767d4e16b8c7cedabfe1c297d4691ef162506a 100644 (file)
@@ -5121,8 +5121,8 @@ variable: opt_pointer ECPGColLabelCommon opt_array_bounds opt_initializer
                                                        *dim = '\0';
                                        else    
                                                        sprintf(dim, "[%s]", dimension);
-                                       /* if (strcmp(length, "0") == 0)*/
-                                       if (atoi(length) <= 0)
+                                       /* 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)