Skip to content

Commit f2af019

Browse files
committed
Make COUNT,SUM case insensitive.
1 parent 514d69b commit f2af019

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/backend/parser/scan.l

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.5 1996/11/30 03:38:09 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.6 1996/12/03 05:06:14 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -164,7 +164,22 @@ other .
164164
if (keyword != NULL) {
165165
return (keyword->value);
166166
} else {
167-
yylval.str = pstrdup((char*)yytext);
167+
if (toupper(((char *)yytext)[0]) == 'A' &&
168+
strcasecmp((char *)yytext,"AVG") == 0)
169+
yylval.str = pstrdup("avg");
170+
else if (toupper(((char *)yytext)[0]) == 'C' &&
171+
strcasecmp((char *)yytext,"COUNT") == 0)
172+
yylval.str = pstrdup("count");
173+
else if (toupper(((char *)yytext)[0]) == 'M' &&
174+
strcasecmp((char *)yytext,"MAX") == 0)
175+
yylval.str = pstrdup("max");
176+
else if (toupper(((char *)yytext)[0]) == 'M' &&
177+
strcasecmp((char *)yytext,"MIN") == 0)
178+
yylval.str = pstrdup("min");
179+
else if (toupper(((char *)yytext)[0]) == 'S' &&
180+
strcasecmp((char *)yytext,"SUM") == 0)
181+
yylval.str = pstrdup("sum");
182+
else yylval.str = pstrdup((char*)yytext);
168183
return (IDENT);
169184
}
170185
}

src/man/create_aggregate.l

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_aggregate.l,v 1.1 1996/11/14 10:15:42 scrappy Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_aggregate.l,v 1.2 1996/12/03 05:06:35 momjian Exp $
44
.TH "CREATE AGGREGATE" SQL 11/05/95 Postgres95 Postgres95
55
.SH NAME
66
create aggregate \(em define a new aggregate
@@ -70,6 +70,9 @@ Aggregates also require two initial conditions, one for each
7070
transition function. These are specified and stored in the database
7171
as fields of type
7272
.IR text .
73+
.PP
74+
For compatability, aggregates named "avg", "count", "max", "min",
75+
and "sum" are lowercased on input.
7376
.SH EXAMPLE
7477
This
7578
.IR avg

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy