From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Thierry Missimilly <THIERRY(dot)MISSIMILLY(at)BULL(dot)NET> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Problem to add a delay to a date |
Date: | 2003-04-03 16:06:40 |
Message-ID: | 20030403080315.J79234-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 3 Apr 2003, Thierry Missimilly wrote:
> I try to create a function in charge of adding a delay to a timestamp.
> Here are the stange results on Postgres 7.3.1.
> working with psql :
>
> test=# select now() + '60' as time;
> time
> --------------------------------------
> 2003-03-24 16:04:53.8680551+01
> (1 row)
>
>
> and when i want to create a function :
>
> test=# create function addtime() returns timestamp as 'select now() +
> ''60'' ' language 'sql';
> ERROR: return type mismatch in function: declared to return timestamp
> without time zone, returns timestamp with time zone
The addition works fine in both cases, but the type of now() + '60' isn't
the same type you defined the function to return. now() returns a
"timestamp with time zone" not a "timestamp without time zone" (which is
what timestamp is). You should be able to just change the return type to
match.
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2003-04-03 16:15:50 | Re: Help with array constraints |
Previous Message | Jason Hihn | 2003-04-03 15:50:32 | Re: Help with array constraints |