Skip to content

Commit f46a80c

Browse files
author
Neil Conway
committed
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.
1 parent 2f17547 commit f46a80c

File tree

3 files changed

+48
-39
lines changed

3 files changed

+48
-39
lines changed

doc/src/sgml/func.sgml

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.187 2004/02/22 04:14:06 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.188 2004/02/27 03:59:23 neilc Exp $
33
PostgreSQL documentation
44
-->
55

@@ -1003,7 +1003,7 @@ PostgreSQL documentation
10031003
<row>
10041004
<entry><literal><function>upper</function>(<parameter>string</parameter>)</literal></entry>
10051005
<entry><type>text</type></entry>
1006-
<entry>Convert string to upper case</entry>
1006+
<entry>Convert string to uppercase</entry>
10071007
<entry><literal>upper('tom')</literal></entry>
10081008
<entry><literal>TOM</literal></entry>
10091009
</row>
@@ -1033,7 +1033,7 @@ PostgreSQL documentation
10331033
<tbody>
10341034
<row>
10351035
<entry><literal><function>ascii</function>(<type>text</type>)</literal></entry>
1036-
<entry>integer</entry>
1036+
<entry><type>integer</type></entry>
10371037
<entry><acronym>ASCII</acronym> code of the first character of the argument</entry>
10381038
<entry><literal>ascii('x')</literal></entry>
10391039
<entry><literal>120</literal></entry>
@@ -1109,16 +1109,20 @@ PostgreSQL documentation
11091109
<row>
11101110
<entry><literal><function>initcap</function>(<type>text</type>)</literal></entry>
11111111
<entry><type>text</type></entry>
1112-
<entry>Convert first letter of each word (whitespace-separated) to upper case</entry>
1113-
<entry><literal>initcap('hi thomas')</literal></entry>
1112+
<entry>
1113+
Convert the first letter of each word to uppercase and the
1114+
rest to lowercase. Words are sequences of alphanumeric
1115+
characters separated by non-alphanumeric characters.
1116+
</entry>
1117+
<entry><literal>initcap('hi THOMAS')</literal></entry>
11141118
<entry><literal>Hi Thomas</literal></entry>
11151119
</row>
11161120

11171121
<row>
1118-
<entry><literal><function>length</function>(<parameter>string</parameter>)</literal></entry>
1122+
<entry><literal><function>length</function>(<parameter>string</parameter> <type>text</type>)</literal></entry>
11191123
<entry><type>integer</type></entry>
11201124
<entry>
1121-
Number of characters in string
1125+
Number of characters in <parameter>string</parameter>.
11221126
<indexterm>
11231127
<primary>character string</primary>
11241128
<secondary>length</secondary>
@@ -1139,7 +1143,7 @@ PostgreSQL documentation
11391143
<parameter>length</parameter> <type>integer</type>
11401144
<optional>, <parameter>fill</parameter> <type>text</type></optional>)</literal>
11411145
</entry>
1142-
<entry>text</entry>
1146+
<entry><type>text</type></entry>
11431147
<entry>
11441148
Fill up the <parameter>string</parameter> to length
11451149
<parameter>length</parameter> by prepending the characters
@@ -1157,7 +1161,8 @@ PostgreSQL documentation
11571161
<entry><type>text</type></entry>
11581162
<entry>
11591163
Remove the longest string containing only characters from
1160-
<parameter>characters</parameter> from the start of the string.
1164+
<parameter>characters</parameter> from the start of
1165+
<parameter>string</parameter>.
11611166
</entry>
11621167
<entry><literal>ltrim('zzzytrim', 'xyz')</literal></entry>
11631168
<entry><literal>trim</literal></entry>
@@ -1167,7 +1172,8 @@ PostgreSQL documentation
11671172
<entry><literal><function>md5</function>(<parameter>string</parameter> <type>text</type>)</literal></entry>
11681173
<entry><type>text</type></entry>
11691174
<entry>
1170-
Calculates the MD5 hash of given string, returning the result in hexadecimal.
1175+
Calculates the MD5 hash of <parameter>string</parameter>,
1176+
returning the result in hexadecimal.
11711177
</entry>
11721178
<entry><literal>md5('abc')</literal></entry>
11731179
<entry><literal>900150983cd24fb0 d6963f7d28e17f72</literal></entry>
@@ -1210,9 +1216,10 @@ PostgreSQL documentation
12101216
</row>
12111217

12121218
<row>
1213-
<entry><literal><function>repeat</function>(<type>text</type>, <type>integer</type>)</literal></entry>
1219+
<entry><literal><function>repeat</function>(<parameter>string</parameter> <type>text</type>, <parameter>number</parameter> <type>integer</type>)</literal></entry>
12141220
<entry><type>text</type></entry>
1215-
<entry>Repeat text a number of times</entry>
1221+
<entry>Repeat <parameter>string</parameter> the specified
1222+
<parameter>number</parameter> of times</entry>
12161223
<entry><literal>repeat('Pg', 4)</literal></entry>
12171224
<entry><literal>PgPgPgPg</literal></entry>
12181225
</row>
@@ -1253,7 +1260,8 @@ PostgreSQL documentation
12531260
<entry><type>text</type></entry>
12541261
<entry>
12551262
Remove the longest string containing only characters from
1256-
<parameter>characters</parameter> from the end of the string.
1263+
<parameter>characters</parameter> from the end of
1264+
<parameter>string</parameter>.
12571265
</entry>
12581266
<entry><literal>rtrim('trimxxxx', 'x')</literal></entry>
12591267
<entry><literal>trim</literal></entry>
@@ -3956,12 +3964,12 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
39563964
<row>
39573965
<entry><literal>AM</literal> or <literal>A.M.</literal> or
39583966
<literal>PM</literal> or <literal>P.M.</literal></entry>
3959-
<entry>meridian indicator (upper case)</entry>
3967+
<entry>meridian indicator (uppercase)</entry>
39603968
</row>
39613969
<row>
39623970
<entry><literal>am</literal> or <literal>a.m.</literal> or
39633971
<literal>pm</literal> or <literal>p.m.</literal></entry>
3964-
<entry>meridian indicator (lower case)</entry>
3972+
<entry>meridian indicator (lowercase)</entry>
39653973
</row>
39663974
<row>
39673975
<entry><literal>Y,YYY</literal></entry>
@@ -4002,64 +4010,64 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
40024010
<row>
40034011
<entry><literal>BC</literal> or <literal>B.C.</literal> or
40044012
<literal>AD</literal> or <literal>A.D.</literal></entry>
4005-
<entry>era indicator (upper case)</entry>
4013+
<entry>era indicator (uppercase)</entry>
40064014
</row>
40074015
<row>
40084016
<entry><literal>bc</literal> or <literal>b.c.</literal> or
40094017
<literal>ad</literal> or <literal>a.d.</literal></entry>
4010-
<entry>era indicator (lower case)</entry>
4018+
<entry>era indicator (lowercase)</entry>
40114019
</row>
40124020
<row>
40134021
<entry><literal>MONTH</literal></entry>
4014-
<entry>full upper-case month name (blank-padded to 9 chars)</entry>
4022+
<entry>full uppercase month name (blank-padded to 9 chars)</entry>
40154023
</row>
40164024
<row>
40174025
<entry><literal>Month</literal></entry>
40184026
<entry>full mixed-case month name (blank-padded to 9 chars)</entry>
40194027
</row>
40204028
<row>
40214029
<entry><literal>month</literal></entry>
4022-
<entry>full lower-case month name (blank-padded to 9 chars)</entry>
4030+
<entry>full lowercase month name (blank-padded to 9 chars)</entry>
40234031
</row>
40244032
<row>
40254033
<entry><literal>MON</literal></entry>
4026-
<entry>abbreviated upper-case month name (3 chars)</entry>
4034+
<entry>abbreviated uppercase month name (3 chars)</entry>
40274035
</row>
40284036
<row>
40294037
<entry><literal>Mon</literal></entry>
40304038
<entry>abbreviated mixed-case month name (3 chars)</entry>
40314039
</row>
40324040
<row>
40334041
<entry><literal>mon</literal></entry>
4034-
<entry>abbreviated lower-case month name (3 chars)</entry>
4042+
<entry>abbreviated lowercase month name (3 chars)</entry>
40354043
</row>
40364044
<row>
40374045
<entry><literal>MM</literal></entry>
40384046
<entry>month number (01-12)</entry>
40394047
</row>
40404048
<row>
40414049
<entry><literal>DAY</literal></entry>
4042-
<entry>full upper-case day name (blank-padded to 9 chars)</entry>
4050+
<entry>full uppercase day name (blank-padded to 9 chars)</entry>
40434051
</row>
40444052
<row>
40454053
<entry><literal>Day</literal></entry>
40464054
<entry>full mixed-case day name (blank-padded to 9 chars)</entry>
40474055
</row>
40484056
<row>
40494057
<entry><literal>day</literal></entry>
4050-
<entry>full lower-case day name (blank-padded to 9 chars)</entry>
4058+
<entry>full lowercase day name (blank-padded to 9 chars)</entry>
40514059
</row>
40524060
<row>
40534061
<entry><literal>DY</literal></entry>
4054-
<entry>abbreviated upper-case day name (3 chars)</entry>
4062+
<entry>abbreviated uppercase day name (3 chars)</entry>
40554063
</row>
40564064
<row>
40574065
<entry><literal>Dy</literal></entry>
40584066
<entry>abbreviated mixed-case day name (3 chars)</entry>
40594067
</row>
40604068
<row>
40614069
<entry><literal>dy</literal></entry>
4062-
<entry>abbreviated lower-case day name (3 chars)</entry>
4070+
<entry>abbreviated lowercase day name (3 chars)</entry>
40634071
</row>
40644072
<row>
40654073
<entry><literal>DDD</literal></entry>
@@ -4099,19 +4107,19 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
40994107
</row>
41004108
<row>
41014109
<entry><literal>RM</literal></entry>
4102-
<entry>month in Roman numerals (I-XII; I=January) (upper case)</entry>
4110+
<entry>month in Roman numerals (I-XII; I=January) (uppercase)</entry>
41034111
</row>
41044112
<row>
41054113
<entry><literal>rm</literal></entry>
4106-
<entry>month in Roman numerals (i-xii; i=January) (lower case)</entry>
4114+
<entry>month in Roman numerals (i-xii; i=January) (lowercase)</entry>
41074115
</row>
41084116
<row>
41094117
<entry><literal>TZ</literal></entry>
4110-
<entry>time-zone name (upper case)</entry>
4118+
<entry>time-zone name (uppercase)</entry>
41114119
</row>
41124120
<row>
41134121
<entry><literal>tz</literal></entry>
4114-
<entry>time-zone name (lower case)</entry>
4122+
<entry>time-zone name (lowercase)</entry>
41154123
</row>
41164124
</tbody>
41174125
</tgroup>
@@ -4144,12 +4152,12 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
41444152
</row>
41454153
<row>
41464154
<entry><literal>TH</literal> suffix</entry>
4147-
<entry>upper-case ordinal number suffix</entry>
4155+
<entry>uppercase ordinal number suffix</entry>
41484156
<entry><literal>DDTH</literal></entry>
41494157
</row>
41504158
<row>
41514159
<entry><literal>th</literal> suffix</entry>
4152-
<entry>lower-case ordinal number suffix</entry>
4160+
<entry>lowercase ordinal number suffix</entry>
41534161
<entry><literal>DDth</literal></entry>
41544162
</row>
41554163
<row>
@@ -6216,7 +6224,7 @@ SELECT TIMESTAMP 'now';
62166224
sequence-function call is specified by a text-string argument. To
62176225
achieve some compatibility with the handling of ordinary
62186226
<acronym>SQL</acronym> names, the sequence functions convert their
6219-
argument to lower case unless the string is double-quoted. Thus
6227+
argument to lowercase unless the string is double-quoted. Thus
62206228
<programlisting>
62216229
nextval('foo') <lineannotation>operates on sequence <literal>foo</literal></>
62226230
nextval('FOO') <lineannotation>operates on sequence <literal>foo</literal></>

doc/src/sgml/plpgsql.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.35 2004/02/03 17:34:02 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.36 2004/02/27 03:59:23 neilc Exp $
33
-->
44

55
<chapter id="plpgsql">
@@ -392,7 +392,7 @@ END;
392392

393393
<para>
394394
All key words and identifiers can be written in mixed upper and
395-
lower case. Identifiers are implicitly converted to lower-case
395+
lower case. Identifiers are implicitly converted to lowercase
396396
unless double-quoted.
397397
</para>
398398

src/backend/utils/adt/oracle_compat.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/utils/adt/oracle_compat.c,v 1.49 2003/11/29 19:51:59 pgsql Exp $
12+
* $PostgreSQL: pgsql/src/backend/utils/adt/oracle_compat.c,v 1.50 2004/02/27 03:59:23 neilc Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -106,9 +106,10 @@ upper(PG_FUNCTION_ARGS)
106106
*
107107
* Purpose:
108108
*
109-
* Returns string, with first letter of each word in uppercase,
110-
* all other letters in lowercase. A word is delimited by white
111-
* space.
109+
* Returns string, with first letter of each word in uppercase, all
110+
* other letters in lowercase. A word is defined as a sequence of
111+
* alphanumeric characters, delimited by non-alphanumeric
112+
* characters.
112113
*
113114
********************************************************************/
114115

@@ -872,7 +873,7 @@ ascii(PG_FUNCTION_ARGS)
872873
********************************************************************/
873874

874875
Datum
875-
chr (PG_FUNCTION_ARGS)
876+
chr(PG_FUNCTION_ARGS)
876877
{
877878
int32 cvalue = PG_GETARG_INT32(0);
878879
text *result;

0 commit comments

Comments
 (0)