Re: Function syntax ? - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Function syntax ?
Date
Msg-id 48C6BD59.8010009@archonet.com
Whole thread Raw
In response to Re: Function syntax ?  ("Scott Marlowe" <scott.marlowe@gmail.com>)
List pgsql-sql
Scott Marlowe wrote:
> On Tue, Sep 9, 2008 at 11:55 AM, Ruben Gouveia <rubes7202@gmail.com> 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 zonepg_catalog | timestamp_larger   | timestamp without time zone |
timestamp without time zone, timestamp without time zonepg_catalog | timestamptz_larger | timestamp with time zone
|
timestamp with time zone, timestamp with time zonepg_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


pgsql-sql by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: Function syntax ?
Next
From: "Ruben Gouveia"
Date:
Subject: Re: Function syntax ?