plpgsql: fix parsing of integer range with underscores

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: pgsql-hackers(at)postgresql(dot)org
Subject: plpgsql: fix parsing of integer range with underscores
Date: 2024-05-15 01:14:36
Message-ID: 808ce947-46ec-4628-85fa-3dd600b2c154@ewie.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-plpgsql-fix-parsing-of-integer-range-with-underscore.patch text/x-diff 3.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-05-15 01:23:37 Re: explain format json, unit for serialize and memory are different.
Previous Message Michael Paquier 2024-05-15 01:14:09 Re: Avoid orphaned objects dependencies, take 3