Re: Query generates infinite loop

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Richard Wesley <richard(at)duckdblabs(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Query generates infinite loop
Date: 2022-05-09 06:19:30
Message-ID: CADkLM=dF+c2mGub1-tTK9c7OJSdK8ZdNZMURmcH8rydDcdpcyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, May 9, 2022 at 12:02 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Corey Huinker <corey(dot)huinker(at)gmail(dot)com> writes:
> > On Wed, May 4, 2022 at 3:01 PM Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> >> On Wed, Apr 20, 2022 at 5:43 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >>> Oh --- looks like numeric generate_series() already throws error for
> >>> this, so we should just make the timestamp variants do the same.
>
> > This came up once before
> >
> https://www.postgresql.org/message-id/CAB7nPqQUuUh_W3s55eSiMnt901Ud3meF7f_96yPkKcqfd1ZaMg%40mail.gmail.com
>
> Oh! I'd totally forgotten that thread, but given that discussion,
> and particularly the counterexample at
>
> https://www.postgresql.org/message-id/16807.1456091547%40sss.pgh.pa.us
>
> it now feels to me like maybe this change was a mistake. Perhaps
> instead of the committed change, we ought to go the other way and
> rip out the infinity checks in numeric generate_series().
>

The infinite-upper-bound-withlimit-pushdown counterexample makes sense, but
seems like we're using generate_series() only because we lack a function
that generates a series of N elements, without a specified upper bound,
something like

generate_finite_series( start, step, num_elements )

And if we did that, I'd lobby that we have one that takes dates as well as
one that takes timestamps, because that was my reason for starting the
thread above.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Miloš Urbánek 2022-05-09 07:21:56 Re: BUG #17476: ERROR: "variable not found in subplan target list" when running SELECT COUNT(*)
Previous Message Amit Kapila 2022-05-09 04:08:03 Re: Security Definer functions no longer works in PG14+

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-05-09 06:47:15 Re: Logical replication timeout problem
Previous Message Tom Lane 2022-05-09 04:02:57 Re: Query generates infinite loop