| From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
|---|---|
| To: | Rich Shepard <rshepard(at)appl-ecosys(dot)com>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Convert date and time colums to datetime |
| Date: | 2025-10-19 16:59:39 |
| Message-ID: | 4729a93e-7d39-4837-8e9b-8ecc2e628b81@aklaver.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 10/19/25 09:35, Rich Shepard wrote:
> On Sun, 19 Oct 2025, Adrian Klaver wrote:
>
>> 2) If you really need a timestamp the work is already done, instead of
>> building on the fly.
>
> Adrian,
>
> As each row in the table already has both a date column and a time column I
> don't know if I 'really' need a timestamp. When would a timestamp be really
> needed?
I would say the fact you are asking is an indication you might need it.
>
>> select ('10/19/2025'::date + '07:50'::time)::timestamptz;
>
> Yes, I saw that on the doc page. This requires manually changing each
> row in
> the table rather than using a date/time condition/function to to create the
> single timestamp column. So, apparently there's not a way to modify the
> table other than by hand.
1) Again you seem to be establishing a need for combined value.
2) Not sure how you do "...date/time condition/function to to create
the single timestamp column" without creating a column?
If you meant creating a timestamp value then I point you at my original
post and:
"2) If you really need a timestamp the work is already done, instead of
building on the fly."
Doing the one time change to add a timestamp field to the table and then
do the UPDATE of date + time to populate it versus calculating it every
time you need the value. Of course moving forward you would need to
change the code that INSERTs new values to use a timestamp instead of a
date and a time value.
>
> Thanks,
>
> Rich
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rich Shepard | 2025-10-19 17:56:34 | Re: Convert date and time colums to datetime |
| Previous Message | Isaac Morland | 2025-10-19 16:46:11 | Re: Convert date and time colums to datetime |