]> granicus.if.org Git - postgresql/commitdiff
Add information about format modifiers that apply to numeric formats.
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 26 Feb 2008 15:32:30 +0000 (15:32 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 26 Feb 2008 15:32:30 +0000 (15:32 +0000)
These were previously only documented in the context of date/time formats.

doc/src/sgml/func.sgml

index 340efac6556ecb70139621c58ccc4ba0be4198f6..b362d8ac0341b2bf1fd6428017515a078b0adeb5 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.419 2007/12/21 03:37:18 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.420 2008/02/26 15:32:30 petere Exp $ -->
 
  <chapter id="functions">
   <title>Functions and Operators</title>
@@ -5320,6 +5320,45 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
     </itemizedlist>
    </para>   
 
+   <para>
+    Certain modifiers can be applied to any template pattern to alter its
+    behavior.  For example, <literal>FM9999</literal>
+    is the <literal>9999</literal> pattern with the
+    <literal>FM</literal> modifier.
+    <xref linkend="functions-formatting-numericmod-table"> shows the
+    modifier patterns for numeric formatting.
+   </para>
+
+    <table id="functions-formatting-numericmod-table">
+     <title>Template Pattern Modifiers for Numeric Formatting</title>
+     <tgroup cols="3">
+      <thead>
+       <row>
+        <entry>Modifier</entry>
+        <entry>Description</entry>
+        <entry>Example</entry>
+       </row>
+      </thead>
+      <tbody>
+       <row>
+        <entry><literal>FM</literal> prefix</entry>
+        <entry>fill mode (suppress padding blanks and zeroes)</entry>
+        <entry><literal>FM9999</literal></entry>
+       </row>
+       <row>
+        <entry><literal>TH</literal> suffix</entry>
+        <entry>uppercase ordinal number suffix</entry>
+        <entry><literal>999TH</literal></entry>
+       </row>   
+       <row>
+        <entry><literal>th</literal> suffix</entry>
+        <entry>lowercase ordinal number suffix</entry>
+        <entry><literal>999th</literal></entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+
   <para>
    <xref linkend="functions-formatting-examples-table"> shows some
    examples of the use of the <function>to_char</function> function.