Scott Marlowe wrote:
> On Tue, Sep 9, 2008 at 11:55 AM, Ruben Gouveia <[EMAIL PROTECTED]> wrote:
>> Does this syntax look correct? Can anyone think of a better way to write
>> this?
>>
>> This function will accept two timestamp parameters and determine the highest
>> of the two?
[snip]
> It certainly works, but there's no real need for the declarations.
> This works just as well:

I'll see your improved function, and raise you some built-ins.

=> \df time*larger
                                                    List of functions
   Schema   |        Name        |      Result data type       |
           Argument data types
------------+--------------------+-----------------------------+----------------------------------------------------------
 pg_catalog | time_larger        | time without time zone      | time
without time zone, time without time zone
 pg_catalog | timestamp_larger   | timestamp without time zone |
timestamp without time zone, timestamp without time zone
 pg_catalog | timestamptz_larger | timestamp with time zone    |
timestamp with time zone, timestamp with time zone
 pg_catalog | timetz_larger      | time with time zone         | time
with time zone, time with time zone
(4 rows)

Also available for other built-in types. Been there ages, used by
aggregate funcs iirc.

-- 
  Richard Huxton
  Archonet Ltd

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to