Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support standard UNION/INTERSECT syntax #248

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Sep 19, 2024

  1. Added standard support for CXXFLAGS.

    Martin Hansson committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    27d77a7 View commit details
    Browse the repository at this point in the history
  2. Initial refactoring.

    - Renamed most rules starting with select_ to the names used in the SQL
      standard, <query expression>, <query expression body>, <query term>, <query
      primary> and <subquery>, respectively.
    
    - Added %expect 0
    
    - The previous rule for UNION/INTERSECT syntax was right-recursive, and so the
      parse tree is right-deep. This patch only changes the rule, you don't want
      right-recursion in an LALR parser, and moreover it's not standard. It doesn't
      change the parse tree structure, so we need an extra wrinkle to build the
      parse tree top-down.
    
    - Indentation follows the most common standard, found in MySQL and Postgres.
    
    Future work: INTERSECT has higher priority than UNION in the standard, but these
    rules give them the same priority.
    Martin Hansson committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    8fb8496 View commit details
    Browse the repository at this point in the history
  3. All of these queries are valid standard SQL. Thanks to the previous

    refactoring, we now have to add only a single rule to support them
    all. Quite surprising, there are not shift/reduce conflicts, which
    are known to occur in both the MySQL and Postgres parsers for this
    construction.
    Martin Hansson committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    d5e68fd View commit details
    Browse the repository at this point in the history
  4. The previous change actually destroyed the part of subquery

    syntax that worked. A union without parentheses was actually
    working. Now we're making the whole thing work. This introduces an
    ambiguity, though, so we fix that with a %prec declaration.
    Martin Hansson committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    cafbfb4 View commit details
    Browse the repository at this point in the history
  5. Manual edit needed after running format.sh.

    Martin Hansson committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    04fe8df View commit details
    Browse the repository at this point in the history