Re: Convert date and time colums to datetime

From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Convert date and time colums to datetime
Date: 2025-10-20 11:05:38
Message-ID: 3cq7x5ky2pn2jabsx7bg67b4c34aijnhxc5ewpgmfot73vftd5@pjlqjnh47ymt
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2025-10-19 20:32:07 -0600, Rob Sargent wrote:
> > On Oct 19, 2025, at 2:38 PM, Rich Shepard <rshepard(at)appl-ecosys(dot)com> wrote:
> > On Sun, 19 Oct 2025, Rob Sargent wrote:
> >> I think you have to ask why those values were separated in the first
> >> place. For instance if they are thought of as a pair in most queries then
> >> an alteration might be in order. There can be a large one time cost if
> >> these tables occur in a lot of separate sql calls in the business logic.
> >
> > Good point. They're in the contacts table and I use them to determine when
> > to make another contact and if prior contacts were more productive in the
> > morning or afternoon.
>
> Definitely a datetime (single value) problem, imho

Actually, to me that seems to be one of the few cases where splitting
them makes sense. I would expect typical updates to be something like
"sane time, but 6 months later" or "same day, but different time". There
might also be constraints like "not before 9am". For queries there might
be stuff like "who do I need to call today", or as Rich already
mentioned, statistics by time of the day. There are probably relatively
few queries where you need to treat date and time as a unit.

hjp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2025-10-20 11:28:10 Re: Arrays vs separate tables
Previous Message Rob Sargent 2025-10-20 02:32:07 Re: Convert date and time colums to datetime