[ Backpatch to 8.0.X.]
authorBruce Momjian <[email protected]>
Fri, 14 Oct 2005 01:50:23 +0000 (01:50 +0000)
committerBruce Momjian <[email protected]>
Fri, 14 Oct 2005 01:50:23 +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 b0019fa9f32bdce8391a14156d01a7726d16c02e..5a9a50b8ce887542def57ab28dbd63735537cd77 100644 (file)
@@ -5142,8 +5142,8 @@ variable: opt_pointer ECPGColLabel 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)