Thread

Commits

  1. Fix PL/pgSQL's handling of integer ranges containing underscores.

  1. plpgsql: fix parsing of integer range with underscores

    Erik Wienhold <ewie@ewie.name> — 2024-05-15T01:14:36Z

    plpgsql fails to parse 1_000..1_000 as 1000..1000 in FOR loops:
    
        DO $$
        DECLARE
            i int;
        BEGIN
            FOR i IN 1_000..1_000 LOOP
            END LOOP;
        END $$;
    
        ERROR:  syntax error at or near "1_000."
        LINE 5:     FOR i IN 1_000..1_000 LOOP
    
    The scan.l defines rule "numericfail" to handle this ambiguity without
    requiring extra whitespace or parenthesis around the integer literals.
    But the rule only accepts digits 0-9.  Again, an oversight in
    faff8f8e47.  Fixed in the attached patch.
    
    -- 
    Erik
    
  2. Re: plpgsql: fix parsing of integer range with underscores

    Dean Rasheed <dean.a.rasheed@gmail.com> — 2024-05-17T08:22:43Z

    On Wed, 15 May 2024 at 02:14, Erik Wienhold <ewie@ewie.name> wrote:
    >
    > plpgsql fails to parse 1_000..1_000 as 1000..1000 in FOR loops:
    >
    > Fixed in the attached patch.
    >
    
    Nice catch! The patch looks good to me on a quick read-through.
    
    I'll take a closer look next week, after the beta release, since it's
    a v16+ bug.
    
    Regards,
    Dean
    
    
    
    
  3. Re: plpgsql: fix parsing of integer range with underscores

    Dean Rasheed <dean.a.rasheed@gmail.com> — 2024-06-04T11:21:21Z

    On Fri, 17 May 2024 at 09:22, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
    >
    > On Wed, 15 May 2024 at 02:14, Erik Wienhold <ewie@ewie.name> wrote:
    > >
    > > plpgsql fails to parse 1_000..1_000 as 1000..1000 in FOR loops:
    > >
    > > Fixed in the attached patch.
    > >
    >
    > Nice catch! The patch looks good to me on a quick read-through.
    >
    > I'll take a closer look next week, after the beta release, since it's
    > a v16+ bug.
    >
    
    (finally got back to this)
    
    Committed and back-patched to v16. Thanks for the report and patch.
    
    Regards,
    Dean
    
    
    
    
  4. Re: plpgsql: fix parsing of integer range with underscores

    Erik Wienhold <ewie@ewie.name> — 2024-06-04T18:08:05Z

    On 2024-06-04 13:21 +0200, Dean Rasheed wrote:
    > Committed and back-patched to v16. Thanks for the report and patch.
    
    Thanks for the review and push Dean.
    
    -- 
    Erik