Doc: update sections 9.7 and 9.8 for new function table layout.
authorTom Lane
Mon, 20 Apr 2020 22:44:12 +0000 (18:44 -0400)
committerTom Lane
Mon, 20 Apr 2020 22:44:12 +0000 (18:44 -0400)
Also some mop-up in section 9.9.

doc/src/sgml/func.sgml

index ca91c7f9154fdf1396d8a40fef2e9c5c694dc18e..1571fbeea6dc282f5cd5be01bce970fb28919e6f 100644 (file)
@@ -3975,7 +3975,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
     This section describes functions and operators for examining and
     manipulating bit strings, that is values of the types
     bit and bit varying.  (While only
-    type bit is mentioned in the tables, values of
+    type bit is mentioned in these tables, values of
     type bit varying can be used interchangeably.)
     Bit strings support the usual comparison operators shown in
     , as well as the
@@ -4670,38 +4670,62 @@ substring('foobar' from '#"o_b#"%' for '#')    NULL
    
     Regular Expression Match Operators
 
-    3">
+    1">
      
       
-       >Operator>
-       Description
-       <entry>Example</entry>
+        role="functableentry">
+        OperatorDescriptionExample(s)
+       
       
      
 
       
        
-         ~ 
-        Matches regular expression, case sensitive
-        'thomas' ~ '.*thomas.*'
+       
+        text ~ text
+        boolean
+       
+        String matches regular expression, case sensitively
+       
+        'thomas' ~ '.*thom.*'
+        t
+       
        
 
        
-         ~* 
-        Matches regular expression, case insensitive
-        'thomas' ~* '.*Thomas.*'
+       
+        text ~* text
+        boolean
+       
+        String matches regular expression, case insensitively
+       
+        'thomas' ~* '.*Thom.*'
+        t
+       
        
 
        
-         !~ 
-        Does not match regular expression, case sensitive
-        'thomas' !~ '.*Thomas.*'
+       
+        text !~ text
+        boolean
+       
+        String does not match regular expression, case sensitively
+       
+        'thomas' !~ '.*thomas.*'
+        f
+       
        
 
        
-         !~* 
-        Does not match regular expression, case insensitive
-        'thomas' !~* '.*vadim.*'
+       
+        text !~* text
+        boolean
+       
+        String does not match regular expression, case insensitively
+       
+        'thomas' !~* '.*vadim.*'
+        t
+       
        
       
      
@@ -6417,97 +6441,114 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
     template that defines the output or input format.
    
 
-    
-     Formatting Functions
-     
-      
-       
-        Function
-        Return Type
-        Description
-        Example
-       
-      
-      
-       
-        
-         
-          to_char
-         
-         to_char(timestamptext)
-        
-        text
-        convert time stamp to string
-        to_char(current_timestamp, 'HH12:MI:SS')
-       
-       
-        to_char(intervaltext)
-        text
-        convert interval to string
-        to_char(interval '15h 2m 12s', 'HH24:MI:SS')
-       
-       
-        to_char(inttext)
-        text
-        convert integer to string
-        to_char(125, '999')
-       
-       
-        to_char(double precision,
-        text)
-        text
-        convert real/double precision to string
-        to_char(125.8::real, '999D9')
-       
-       
-        to_char(numerictext)
-        text
-        convert numeric to string
-        to_char(-125.8, '999D99S')
-       
-       
-        
-         
-          to_date
-         
-         to_date(texttext)
-        
-        date
-        convert string to date
-        to_date('05 Dec 2000', 'DD Mon YYYY')
-       
-       
-        
-         
-          to_number
-         
-         to_number(texttext)
-        
-        numeric
-        convert string to numeric
-        to_number('12,454.8-', '99G999D9S')
-       
-       
-        
-         
-          to_timestamp
-         
-         to_timestamp(texttext)
-        
-        timestamp with time zone
-        convert string to time stamp
-        to_timestamp('05 Dec 2000', 'DD Mon YYYY')
-       
-      
-     
-    
+   
+    Formatting Functions
+    
+     
+      
+       
+        FunctionDescriptionExample(s)
+       
+      
+     
 
-   
-    
-     There is also a single-argument to_timestamp
-     function; see .
-    
-   
+     
+      
+       
+        
+         to_char
+        
+        to_char ( timestamp with time zonetext )
+        text
+       
+        Converts time stamp to string according to the given format.
+       
+        to_char(timestamp '2002-04-20 17:31:12.66', 'HH12:MI:SS')
+        05:31:12
+       
+      
+
+      
+       
+        to_char ( intervaltext )
+        text
+       
+        Converts interval to string according to the given format.
+       
+       to_char(interval '15h 2m 12s', 'HH24:MI:SS')
+       15:02:12
+       
+      
+
+      
+       
+        to_char ( numeric_typetext )
+        text
+       
+        Converts number to string according to the given format; available
+        for integerbigintnumeric,
+        realdouble precision.
+       
+        to_char(125, '999')
+        125
+       
+        to_char(125.8::real, '999D9')
+        125.8
+       
+        to_char(-125.8, '999D99S')
+        125.80-
+       
+      
+
+      
+       
+        
+         to_date
+        
+        to_date ( texttext )
+        date
+       
+        Converts string to date according to the given format.
+       
+        to_date('05 Dec 2000', 'DD Mon YYYY')
+        2000-12-05
+       
+      
+
+      
+       
+        
+         to_number
+        
+        to_number ( texttext )
+        numeric
+       
+        Converts string to numeric according to the given format.
+       
+        to_number('12,454.8-', '99G999D9S')
+        -12454.8
+       
+      
+
+      
+       
+        
+         to_timestamp
+        
+        to_timestamp ( texttext )
+        timestamp with time zone
+       
+        Converts string to time stamp according to the given format.
+        (See also to_timestamp(double precision) in
+        .)
+       
+        to_timestamp('05 Dec 2000', 'DD Mon YYYY')
+        2000-12-05 00:00:00-05
+       
+      
+     
+    
+   
 
    
     
@@ -8739,9 +8780,7 @@ SELECT EXTRACT(QUARTER FROM TIMESTAMP '2001-02-16 20:38:40');
       second
       
        
-        The seconds field, including fractional parts (0 -
-        5960 if leap seconds are
-        implemented by the operating system)
+        The seconds field, including any fractional seconds
        
 
 
@@ -8969,48 +9008,66 @@ SELECT date_trunc('hour', INTERVAL '3 days 02:47:33');
    
 
    
-    The AT TIME ZONE converts time
-    stamp without time zone to/from
-    time stamp with time zone, and
-    time values to different time zones. 
-    linkend="functions-datetime-zoneconvert-table"/> shows its variants.
+    The AT TIME ZONE operator converts time
+    stamp without time zone to/from
+    time stamp with time zone, and
+    time with time zone values to different time
+    zones.  shows its
+    variants.
    
 
     
      <literal>AT TIME ZONE</literal> Variants
-     3">
+     1">
       
        
-        >Expression>
-        Return Type
-        <entry>Description</entry>
+         role="functableentry">
+         OperatorDescriptionExample(s)
+        
        
       
 
       
        
-        
-         timestamp without time zone AT TIME ZONE zone
+        
+         timestamp without time zone AT TIME ZONE zone
+         timestamp with time zone
+        
+         Converts given time stamp without time zone to
+         time stamp with time zone, assuming the given
+         value is in the named time zone.
+        
+         timestamp '2001-02-16 20:38:40' at time zone 'America/Denver'
+         2001-02-17 03:38:40+00
         
-        timestamp with time zone
-        Treat given time stamp without time zone as located in the specified time zone
        
 
        
-        
-         timestamp with time zone AT TIME ZONE zone
+        
+         timestamp with time zone AT TIME ZONE zone
+         timestamp without time zone
+        
+         Converts given time stamp with time zone to
+         time stamp without time zone, as the time would
+         appear in that zone.
+        
+         timestamp with time zone '2001-02-16 20:38:40-05' at time zone 'America/Denver'
+         2001-02-16 18:38:40
         
-        timestamp without time zone
-        Convert given time stamp with time zone to the new time
-        zone, with no time zone designation
        
 
        
-        
-         time with time zone AT TIME ZONE zone
+        
+         time with time zone AT TIME ZONE zone
+         time with time zone
+        
+         Converts given time with time zone to a new time
+         zone.  Since no date is supplied, this uses the currently active UTC
+         offset for the named destination zone.
+        
+         time with time zone '05:34:17-05' at time zone 'UTC'
+         10:34:17+00
         
-        time with time zone
-        Convert given time with time zone to the new time zone
        
       
      
@@ -9018,14 +9075,17 @@ SELECT date_trunc('hour', INTERVAL '3 days 02:47:33');
 
    
     In these expressions, the desired time zone zone can be
-    specified either as a text string (e.g., 'America/Los_Angeles')
+    specified either as a text value (e.g., 'America/Los_Angeles')
     or as an interval (e.g., INTERVAL '-08:00').
     In the text case, a time zone name can be specified in any of the ways
     described in .
+    The interval case is only useful for zones that have fixed offsets from
+    UTC, so it is not very common in practice.
    
 
    
-    Examples (assuming the local time zone is America/Los_Angeles):
+    Examples (assuming the current  setting
+    is America/Los_Angeles):
 
 SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'America/Denver';
 Result: 2001-02-16 19:38:40-08
@@ -9033,7 +9093,7 @@ SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'America/Denver';
 SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'America/Denver';
 Result: 2001-02-16 18:38:40
 
-SELECT TIMESTAMP '2001-02-16 20:38:40-05' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'America/Chicago';
+SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'America/Chicago';
 Result: 2001-02-16 05:38:40
 
     The first example adds a time zone to a value that lacks it, and
@@ -9042,9 +9102,7 @@ SELECT TIMESTAMP '2001-02-16 20:38:40-05' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE
     to the specified time zone, and returns the value without a time zone.
     This allows storage and display of values different from the current
     TimeZone setting.  The third example converts
-    Tokyo time to Chicago time.   Converting time
-    values to other time zones uses the currently active time zone rules
-    since no date is supplied.
+    Tokyo time to Chicago time.
    
 
    
@@ -9225,17 +9283,16 @@ SELECT TIMESTAMP 'now';  -- incorrect for use with DEFAULT
     The following functions are available to delay execution of the server
     process:
 
-pg_sleep(seconds)
-pg_sleep_for(interval)
-pg_sleep_until(timestamp with time zone)
+pg_sleep ( double precision )
+pg_sleep_for ( interval )
+pg_sleep_until ( timestamp with time zone )
 
 
     pg_sleep makes the current session's process
-    sleep until seconds seconds have
-    elapsed.  seconds is a value of type
-    double precision, so fractional-second delays can be specified.
-    pg_sleep_for is a convenience function for larger
-    sleep times specified as an interval.
+    sleep until the given number of seconds have
+    elapsed.  Fractional-second delays can be specified.
+    pg_sleep_for is a convenience function to
+    allow the sleep time to be specified as an interval.
     pg_sleep_until is a convenience function for when
     a specific wake-up time is desired.
     For example: