> "Hutton, Rob" wrote:
>
> I have created a table with date and time fields by using what I
> read as being the correct default statements, but I get the date and
> time the DB was created at each insert instead of the current date and
> time.
> | ord_time | time default text 'now'
> | 8 |
> | ord_date | date default text 'now'
> | 4 |
> | ord_timestamp | timestamp default text 'now'
> | 4 |
You should not use 'now'. It will be replaced with the current time.
Instead use now() and remove "text".
Also, I'd skip the time and date fields and exchange timestamp with
datetime. You would still be able to get the date and time from the
ord_timestamp field using:
select ord_timestamp::time, ord_timestamp::date from tablename;
The reason I'd use datetime instead of datetime is because you
can't cast from timestamp to time (afaik).
Hope this helps.
/Kudo