It more than helps: it opens all kinds of possibilities.
So, my question now is:
Should I have designed the database with a 'date' and 'time' columns from the
beginning (vs. just a timestamp)?
Thank you very much,
Bill Totman
On Sunday 29 July 2007 18:26, you wrote:
> I believe casting the timestamp to time (or timetz) and date will do
> what you want:
>
> test=# select current_timestamp, current_timestamp::timetz,
> current_timestamp::date;
> now | now | now
> -------------------------------+--------------------+------------
> 2007-07-29 18:16:49.643542-05 | 18:16:49.643542-05 | 2007-07-29
> (1 row)
>
> If both date and time are important, I'd recommend keeping them in a
> timestamp and decomposing when you need to. Depending on what kinds
> of queries are performed, you may also want to look into using
> expressional indexes, such as:
>
> CREATE INDEX timestamptz_col_date_idx ON foo (timestamptz_col::date);
> CREATE INDEX timestamptz_col_timetz_idx ON foo
> (timestamptz_col::timetz);
>
> Hope this helps.
>
> Michael Glaesemann
> grzm seespotcode net