Add tests for UNBOUNDED syntax ambiguity

Started by Peter Eisentrautalmost 5 years ago2 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

As many will be aware, there is a syntactic ambiguity in the SQL
standard regarding the keyword UNBOUNDED. Since UNBOUNDED is a
non-reserved word, it could be the name of a function parameter and be
used as an expression. There is a grammar hack to resolve such cases as
the keyword.

I brought this issue to the SQL standard working group, and a fix has
been agreed. (Since long-standing syntax obviously can't be changed,
the fix is basically just an additional rule saying, "if you see this,
it means the keyword".) While working on that, I wrote a few test cases
to explore this and check how PostgreSQL actually handles this. I
figure these test cases are worth committing so that we have a record of
this and future grammar refactorings can maintain the behavior.

Attachments:

0001-Add-tests-for-UNBOUNDED-syntax-ambiguity.patchtext/plain; charset=UTF-8; name=0001-Add-tests-for-UNBOUNDED-syntax-ambiguity.patch; x-mac-creator=0; x-mac-type=0Download+206-1
#2Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Peter Eisentraut (#1)
Re: Add tests for UNBOUNDED syntax ambiguity

On 24/06/2021 12:01, Peter Eisentraut wrote:

As many will be aware, there is a syntactic ambiguity in the SQL
standard regarding the keyword UNBOUNDED. Since UNBOUNDED is a
non-reserved word, it could be the name of a function parameter and be
used as an expression. There is a grammar hack to resolve such cases as
the keyword.

I brought this issue to the SQL standard working group, and a fix has
been agreed. (Since long-standing syntax obviously can't be changed,
the fix is basically just an additional rule saying, "if you see this,
it means the keyword".)

Nice!

While working on that, I wrote a few test cases to explore this and
check how PostgreSQL actually handles this. I figure these test
cases are worth committing so that we have a record of this and
future grammar refactorings can maintain the behavior.

+1

- Heikki