On Tue, 2006-12-19 at 19:16 -0500, Tom Lane wrote: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > Perhaps it would be more effective to clarify the error message? Right > > now it just says something to the effect of "invalid integer". I'd > > imagine "invalid memory unit: TB" would be less confusing. > > +1 on that, but I think we should just accept the strings > case-insensitively, too. SQL in general is not case sensitive for > keywords, and neither is anything else in the postgresql.conf file, > so I argue it's inconsistent to be strict about the case for units.
Hello, Attached is a simple patch that replaces strcmp() with pg_strcasecmp(). Thanks to AndrewS for pointing out that I shouldn't use strcasecp(). I compiled and installed, ran an initdb with 32mb (versus 32MB) and it seems to work correctly with a show shared_buffers; Sincerely, Joshua D. Drake -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/ Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
Index: guc.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/guc.c,v retrieving revision 1.362 diff -c -r1.362 guc.c *** guc.c 13 Dec 2006 05:54:48 -0000 1.362 --- guc.c 20 Dec 2006 00:59:15 -0000 *************** *** 3630,3647 **** while (*endptr == ' ') endptr++; ! if (strcmp(endptr, "kB") == 0) { used = true; endptr += 2; } ! else if (strcmp(endptr, "MB") == 0) { val *= KB_PER_MB; used = true; endptr += 2; } ! else if (strcmp(endptr, "GB") == 0) { val *= KB_PER_GB; used = true; --- 3630,3647 ---- while (*endptr == ' ') endptr++; ! if (pg_strcasecmp(endptr, "kB") == 0) { used = true; endptr += 2; } ! else if (pg_strcasecmp(endptr, "MB") == 0) { val *= KB_PER_MB; used = true; endptr += 2; } ! else if (pg_strcasecmp(endptr, "GB") == 0) { val *= KB_PER_GB; used = true; *************** *** 3669,3698 **** while (*endptr == ' ') endptr++; ! if (strcmp(endptr, "ms") == 0) { used = true; endptr += 2; } ! else if (strcmp(endptr, "s") == 0) { val *= MS_PER_S; used = true; endptr += 1; } ! else if (strcmp(endptr, "min") == 0) { val *= MS_PER_MIN; used = true; endptr += 3; } ! else if (strcmp(endptr, "h") == 0) { val *= MS_PER_H; used = true; endptr += 1; } ! else if (strcmp(endptr, "d") == 0) { val *= MS_PER_D; used = true; --- 3669,3698 ---- while (*endptr == ' ') endptr++; ! if (pg_strcasecmp(endptr, "ms") == 0) { used = true; endptr += 2; } ! else if (pg_strcasecmp(endptr, "s") == 0) { val *= MS_PER_S; used = true; endptr += 1; } ! else if (pg_strcasecmp(endptr, "min") == 0) { val *= MS_PER_MIN; used = true; endptr += 3; } ! else if (pg_strcasecmp(endptr, "h") == 0) { val *= MS_PER_H; used = true; endptr += 1; } ! else if (pg_strcasecmp(endptr, "d") == 0) { val *= MS_PER_D; used = true;
---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq