Make COUNT,SUM case insensitive.
authorBruce Momjian <[email protected]>
Tue, 3 Dec 1996 05:06:35 +0000 (05:06 +0000)
committerBruce Momjian <[email protected]>
Tue, 3 Dec 1996 05:06:35 +0000 (05:06 +0000)
src/backend/parser/scan.l
src/man/create_aggregate.l

index df824124671cea5e749a4d6ad6f6c9482fab52dc..df0fa826dce198da7a618e6b599cd85e3df644e2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.5 1996/11/30 03:38:09 momjian Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.6 1996/12/03 05:06:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -164,7 +164,22 @@ other      .
            if (keyword != NULL) {
                return (keyword->value);
            } else {
-               yylval.str = pstrdup((char*)yytext);
+               if (toupper(((char *)yytext)[0]) == 'A' &&
+                   strcasecmp((char *)yytext,"AVG") == 0)
+                   yylval.str = pstrdup("avg");
+               else if (toupper(((char *)yytext)[0]) == 'C' &&
+                   strcasecmp((char *)yytext,"COUNT") == 0)
+                   yylval.str = pstrdup("count");
+               else if (toupper(((char *)yytext)[0]) == 'M' &&
+                   strcasecmp((char *)yytext,"MAX") == 0)
+                   yylval.str = pstrdup("max");
+               else if (toupper(((char *)yytext)[0]) == 'M' &&
+                   strcasecmp((char *)yytext,"MIN") == 0)
+                   yylval.str = pstrdup("min");
+               else if (toupper(((char *)yytext)[0]) == 'S' &&
+                   strcasecmp((char *)yytext,"SUM") == 0)
+                   yylval.str = pstrdup("sum");
+               else    yylval.str = pstrdup((char*)yytext);
                return (IDENT);
            }
        }
index 8d42585776aa74c01e5195c1e02936df277dd620..615d92c33623fd55779707633fc605440066f33d 100644 (file)
@@ -1,6 +1,6 @@
 .\" This is -*-nroff-*-
 .\" XXX standard disclaimer belongs here....
-.\" $Header: /cvsroot/pgsql/src/man/Attic/create_aggregate.l,v 1.1 1996/11/14 10:15:42 scrappy Exp $
+.\" $Header: /cvsroot/pgsql/src/man/Attic/create_aggregate.l,v 1.2 1996/12/03 05:06:35 momjian Exp $
 .TH "CREATE AGGREGATE" SQL 11/05/95 Postgres95 Postgres95
 .SH NAME
 create aggregate \(em define a new aggregate
@@ -70,6 +70,9 @@ Aggregates also require two initial conditions, one for each
 transition function.  These are specified and stored in the database
 as fields of type
 .IR text .
+.PP
+For compatability, aggregates named "avg", "count", "max", "min",
+and "sum" are lowercased on input.
 .SH EXAMPLE
 This
 .IR avg