1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-23 03:21:12 +03:00

Augment info on string functions per Jose Soares' suggestions.

This commit is contained in:
Thomas G. Lockhart
1999-01-19 16:11:18 +00:00
parent bda6246664
commit f3fde99841

View File

@ -71,6 +71,8 @@ available through operators and may be documented as operators only.
<Para> <Para>
SQL92 defines string functions with specific syntax. Some of these SQL92 defines string functions with specific syntax. Some of these
are implemented using other <ProductName>Postgres</ProductName> functions. are implemented using other <ProductName>Postgres</ProductName> functions.
The supported string types for <acronym>SQL92</acronym> are
<type>char</type>, <type>varchar</type>, and <type>text</type>.
</Para> </Para>
<Para> <Para>
@ -87,30 +89,60 @@ are implemented using other <ProductName>Postgres</ProductName> functions.
</THEAD> </THEAD>
<TBODY> <TBODY>
<ROW> <ROW>
<ENTRY> position(text in text) </ENTRY> <ENTRY> char_length(string) </ENTRY>
<ENTRY> int4 </ENTRY>
<ENTRY> length of string </ENTRY>
<ENTRY> char_length('jose') </ENTRY>
</ROW>
<ROW>
<ENTRY> character_length(string) </ENTRY>
<ENTRY> int4 </ENTRY>
<ENTRY> length of string </ENTRY>
<ENTRY> char_length('jose') </ENTRY>
</ROW>
<ROW>
<ENTRY> lower(string) </ENTRY>
<ENTRY> string </ENTRY>
<ENTRY> convert string to lower case </ENTRY>
<ENTRY> lower('TOM') </ENTRY>
</ROW>
<ROW>
<ENTRY> octet_length(string) </ENTRY>
<ENTRY> int4 </ENTRY>
<ENTRY> storage length of string </ENTRY>
<ENTRY> octet_length('jose') </ENTRY>
</ROW>
<ROW>
<ENTRY> position(string in string) </ENTRY>
<ENTRY> int4 </ENTRY> <ENTRY> int4 </ENTRY>
<ENTRY> location of specified substring </ENTRY> <ENTRY> location of specified substring </ENTRY>
<ENTRY> position('o' in 'Tom') </ENTRY> <ENTRY> position('o' in 'Tom') </ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> substring(text [from int] [for int]) </ENTRY> <ENTRY> substring(string [from int] [for int]) </ENTRY>
<ENTRY> text </ENTRY> <ENTRY> string </ENTRY>
<ENTRY> extract specified substring </ENTRY> <ENTRY> extract specified substring </ENTRY>
<ENTRY> substring('Tom' from 2 for 2) </ENTRY> <ENTRY> substring('Tom' from 2 for 2) </ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> trim([leading|trailing|both] [text] from text) </ENTRY> <ENTRY> trim([leading|trailing|both] [string] from string) </ENTRY>
<ENTRY> text </ENTRY> <ENTRY> string </ENTRY>
<ENTRY> trim characters from text </ENTRY> <ENTRY> trim characters from string </ENTRY>
<ENTRY> trim(both 'x' from 'xTomx') </ENTRY> <ENTRY> trim(both 'x' from 'xTomx') </ENTRY>
</ROW> </ROW>
<ROW>
<ENTRY> upper(text) </ENTRY>
<ENTRY> text </ENTRY>
<ENTRY> convert text to upper case </ENTRY>
<ENTRY> upper('tom') </ENTRY>
</ROW>
</TBODY> </TBODY>
</TGROUP> </TGROUP>
</TABLE> </TABLE>
</Para> </Para>
<Para> <Para>
Many string functions are available for text, varchar(), and char() types. Many additional string functions are available for text, varchar(), and char() types.
Some are used internally to implement the SQL92 string functions listed above. Some are used internally to implement the SQL92 string functions listed above.
</Para> </Para>
@ -146,12 +178,6 @@ Some are used internally to implement the SQL92 string functions listed above.
<ENTRY> initcap('thomas') </ENTRY> <ENTRY> initcap('thomas') </ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> lower(text) </ENTRY>
<ENTRY> text </ENTRY>
<ENTRY> convert text to lower case </ENTRY>
<ENTRY> lower('TOM') </ENTRY>
</ROW>
<ROW>
<ENTRY> lpad(text,int,text) </ENTRY> <ENTRY> lpad(text,int,text) </ENTRY>
<ENTRY> text </ENTRY> <ENTRY> text </ENTRY>
<ENTRY> left pad string to specified length </ENTRY> <ENTRY> left pad string to specified length </ENTRY>
@ -164,9 +190,9 @@ Some are used internally to implement the SQL92 string functions listed above.
<ENTRY> ltrim('xxxxtrim','x') </ENTRY> <ENTRY> ltrim('xxxxtrim','x') </ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> position(text,text) </ENTRY> <ENTRY> textpos(text,text) </ENTRY>
<ENTRY> text </ENTRY> <ENTRY> text </ENTRY>
<ENTRY> extract specified substring </ENTRY> <ENTRY> locate specified substring </ENTRY>
<ENTRY> position('high','ig') </ENTRY> <ENTRY> position('high','ig') </ENTRY>
</ROW> </ROW>
<ROW> <ROW>
@ -217,12 +243,6 @@ Some are used internally to implement the SQL92 string functions listed above.
<ENTRY> convert text to varchar type </ENTRY> <ENTRY> convert text to varchar type </ENTRY>
<ENTRY> varchar('text string') </ENTRY> <ENTRY> varchar('text string') </ENTRY>
</ROW> </ROW>
<ROW>
<ENTRY> upper(text) </ENTRY>
<ENTRY> text </ENTRY>
<ENTRY> convert text to upper case </ENTRY>
<ENTRY> upper('tom') </ENTRY>
</ROW>
</TBODY> </TBODY>
</TGROUP> </TGROUP>
</TABLE> </TABLE>
@ -689,3 +709,19 @@ support functions.
</chapter> </chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"./reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->