From f46a80c3625e394b174256e3a3a1ad931b1478da Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Fri, 27 Feb 2004 03:59:23 +0000 Subject: [PATCH] Fix a few omissions in the initcap() documentation & source code comments, make some unrelated improvements to the functions documentation, and perform some minor consistency cleanup elsewhere. Original initcap() change from Dennis B., additional changes by Neil C. --- doc/src/sgml/func.sgml | 72 +++++++++++++++------------ doc/src/sgml/plpgsql.sgml | 4 +- src/backend/utils/adt/oracle_compat.c | 11 ++-- 3 files changed, 48 insertions(+), 39 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index d047d045bd..6585fca522 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ @@ -1003,7 +1003,7 @@ PostgreSQL documentation upper(string) text - Convert string to upper case + Convert string to uppercase upper('tom') TOM @@ -1033,7 +1033,7 @@ PostgreSQL documentation ascii(text) - integer + integer ASCII code of the first character of the argument ascii('x') 120 @@ -1109,16 +1109,20 @@ PostgreSQL documentation initcap(text) text - Convert first letter of each word (whitespace-separated) to upper case - initcap('hi thomas') + + Convert the first letter of each word to uppercase and the + rest to lowercase. Words are sequences of alphanumeric + characters separated by non-alphanumeric characters. + + initcap('hi THOMAS') Hi Thomas - length(string) + length(string text) integer - Number of characters in string + Number of characters in string. character string length @@ -1139,7 +1143,7 @@ PostgreSQL documentation length integer , fill text) - text + text Fill up the string to length length by prepending the characters @@ -1157,7 +1161,8 @@ PostgreSQL documentation text Remove the longest string containing only characters from - characters from the start of the string. + characters from the start of + string. ltrim('zzzytrim', 'xyz') trim @@ -1167,7 +1172,8 @@ PostgreSQL documentation md5(string text) text - Calculates the MD5 hash of given string, returning the result in hexadecimal. + Calculates the MD5 hash of string, + returning the result in hexadecimal. md5('abc') 900150983cd24fb0 d6963f7d28e17f72 @@ -1210,9 +1216,10 @@ PostgreSQL documentation - repeat(text, integer) + repeat(string text, number integer) text - Repeat text a number of times + Repeat string the specified + number of times repeat('Pg', 4) PgPgPgPg @@ -1253,7 +1260,8 @@ PostgreSQL documentation text Remove the longest string containing only characters from - characters from the end of the string. + characters from the end of + string. rtrim('trimxxxx', 'x') trim @@ -3956,12 +3964,12 @@ substring('foobar' from 'o(.)b') o AM or A.M. or PM or P.M. - meridian indicator (upper case) + meridian indicator (uppercase) am or a.m. or pm or p.m. - meridian indicator (lower case) + meridian indicator (lowercase) Y,YYY @@ -4002,16 +4010,16 @@ substring('foobar' from 'o(.)b') o BC or B.C. or AD or A.D. - era indicator (upper case) + era indicator (uppercase) bc or b.c. or ad or a.d. - era indicator (lower case) + era indicator (lowercase) MONTH - full upper-case month name (blank-padded to 9 chars) + full uppercase month name (blank-padded to 9 chars) Month @@ -4019,11 +4027,11 @@ substring('foobar' from 'o(.)b') o month - full lower-case month name (blank-padded to 9 chars) + full lowercase month name (blank-padded to 9 chars) MON - abbreviated upper-case month name (3 chars) + abbreviated uppercase month name (3 chars) Mon @@ -4031,7 +4039,7 @@ substring('foobar' from 'o(.)b') o mon - abbreviated lower-case month name (3 chars) + abbreviated lowercase month name (3 chars) MM @@ -4039,7 +4047,7 @@ substring('foobar' from 'o(.)b') o DAY - full upper-case day name (blank-padded to 9 chars) + full uppercase day name (blank-padded to 9 chars) Day @@ -4047,11 +4055,11 @@ substring('foobar' from 'o(.)b') o day - full lower-case day name (blank-padded to 9 chars) + full lowercase day name (blank-padded to 9 chars) DY - abbreviated upper-case day name (3 chars) + abbreviated uppercase day name (3 chars) Dy @@ -4059,7 +4067,7 @@ substring('foobar' from 'o(.)b') o dy - abbreviated lower-case day name (3 chars) + abbreviated lowercase day name (3 chars) DDD @@ -4099,19 +4107,19 @@ substring('foobar' from 'o(.)b') o RM - month in Roman numerals (I-XII; I=January) (upper case) + month in Roman numerals (I-XII; I=January) (uppercase) rm - month in Roman numerals (i-xii; i=January) (lower case) + month in Roman numerals (i-xii; i=January) (lowercase) TZ - time-zone name (upper case) + time-zone name (uppercase) tz - time-zone name (lower case) + time-zone name (lowercase) @@ -4144,12 +4152,12 @@ substring('foobar' from 'o(.)b') o TH suffix - upper-case ordinal number suffix + uppercase ordinal number suffix DDTH th suffix - lower-case ordinal number suffix + lowercase ordinal number suffix DDth @@ -6216,7 +6224,7 @@ SELECT TIMESTAMP 'now'; sequence-function call is specified by a text-string argument. To achieve some compatibility with the handling of ordinary SQL names, the sequence functions convert their - argument to lower case unless the string is double-quoted. Thus + argument to lowercase unless the string is double-quoted. Thus nextval('foo') operates on sequence foo nextval('FOO') operates on sequence foo diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index 7cce45b75e..c84967f326 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -1,5 +1,5 @@ @@ -392,7 +392,7 @@ END; All key words and identifiers can be written in mixed upper and - lower case. Identifiers are implicitly converted to lower-case + lower case. Identifiers are implicitly converted to lowercase unless double-quoted. diff --git a/src/backend/utils/adt/oracle_compat.c b/src/backend/utils/adt/oracle_compat.c index f278eaf730..eca71de6fc 100644 --- a/src/backend/utils/adt/oracle_compat.c +++ b/src/backend/utils/adt/oracle_compat.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/oracle_compat.c,v 1.49 2003/11/29 19:51:59 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/oracle_compat.c,v 1.50 2004/02/27 03:59:23 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -106,9 +106,10 @@ upper(PG_FUNCTION_ARGS) * * Purpose: * - * Returns string, with first letter of each word in uppercase, - * all other letters in lowercase. A word is delimited by white - * space. + * Returns string, with first letter of each word in uppercase, all + * other letters in lowercase. A word is defined as a sequence of + * alphanumeric characters, delimited by non-alphanumeric + * characters. * ********************************************************************/ @@ -872,7 +873,7 @@ ascii(PG_FUNCTION_ARGS) ********************************************************************/ Datum -chr (PG_FUNCTION_ARGS) +chr(PG_FUNCTION_ARGS) { int32 cvalue = PG_GETARG_INT32(0); text *result;