Re: Function syntax ?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: Ruben Gouveia <rubes7202(at)gmail(dot)com>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Function syntax ?
Date: 2008-09-09 18:15:53
Message-ID: 48C6BD59.8010009@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Scott Marlowe wrote:
> On Tue, Sep 9, 2008 at 11:55 AM, Ruben Gouveia <rubes7202(at)gmail(dot)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 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Scott Marlowe 2008-09-09 18:15:56 Re: Function syntax ?
Previous Message Ruben Gouveia 2008-09-09 18:11:59 Re: Function syntax ?