Re: Fix formatting of Interval output

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joseph Koshakow <koshy44(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix formatting of Interval output
Date: 2022-02-19 18:52:22
Message-ID: 77010.1645296742@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joseph Koshakow <koshy44(at)gmail(dot)com> writes:
> On Sat, Feb 19, 2022 at 12:00 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I think that messing with struct pg_tm might have too many side-effects.
>> However, pg_tm isn't all that well adapted to intervals in the first
>> place, so it'd make sense to make a new struct specifically for interval
>> decoding.

> Yeah that's a good idea, pg_tm is used all over the place. Is there a
> reason we need an intermediate structure to convert to and from?
> We could just convert directly to an Interval in DecodeInterval and
> print directly from an Interval in EncodeInterval.

Yeah, I thought about that too, but if you look at the other callers of
interval2tm, you'll see this same set of issues. I'm inclined to keep
the current code structure and just fix the data structure. Although
interval2tm isn't *that* big, I don't think four copies of its logic
would be an improvement.

> Also I originally created a separate thread and patch because I
> thought this wouldn't be directly related to my other patch,
> https://commitfest.postgresql.org/37/3541/. However I think with these
> discussed changes it's directly related. So I think it's best to close
> this thread and patch and copy this conversion to the other thread.

Agreed.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2022-02-19 19:24:09 Re: doc: join state for merge join
Previous Message Andrew Dunstan 2022-02-19 18:47:41 Re: killing perl2host