GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — CREATE TRIGGER sql queries do NOT get parsed nor validated. · Issue #1453 · JSQLParser/JSqlParser

CREATE TRIGGER sql queries do NOT get parsed nor validated. #1453

New issue
Copy link
New issue
Copy link
Closed
#1778
Closed
CREATE TRIGGER sql queries do NOT get parsed nor validated.#1453
#1778
Copy link

Description

@atharmutallib
atharmutallib
opened on Jan 6, 2022
Issue body actions

Describe the bug
CREATE TRIGGER sql queries do NOT get parsed nor validated.

To Reproduce
Steps to reproduce the behavior:

  1. Example SQL: create trigger stud_marks before INSERT on Student for each row set Student.total = Student.subj1 + Student.subj2, Student.per = Student.total * 60 / 100;
  2. Parsing this SQL using JSqlParser with this statements
  3. Exception:
    net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "create" "CREATE"
    at line 1, column 1.

Was expecting one of:

"("
"ALTER"
"CALL"
"COMMENT"
"COMMIT"
"DECLARE"
"DELETE"
"DESCRIBE"
"DROP"
"EXEC"
"EXECUTE"
"EXPLAIN"
"GRANT"
"INSERT"
"MERGE"
"PURGE"
"RENAME"
"RESET"
"ROLLBACK"
"SAVEPOINT"
"SET"
"SHOW"
"TRUNCATE"
"UPDATE"
"UPSERT"
"USE"
"VALUES"
"WITH"
<K_SELECT>


at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:190)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:63)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:38)

Expected behavior
Should parse the sql. If validated, no errors should exist.

System

  • Database you are using: IBM DB2
  • Java Version: Java 8
  • JSqlParser version: 4.3
Reacted by Bhatt Umang

Activity

  1. atharmutallib
    changed the title [-]CREATE TRIGGER sql queries do get parsed or validated.[/-] [+]CREATE TRIGGER sql queries do NOT get parsed nor validated.[/+] on Jan 6, 2022
  2. manticore-projects
    added a commit that references this issue on May 16, 2023

    refactor: CREATE and ALTER productions

    This issue will close once commit da32442 is merged into the 'master' branch.
    da32442
  3. manticore-projects commented on May 16, 2023

    @manticore-projects
    manticore-projects
    on May 16, 2023
    Contributor
    More actions

    Worked around by returning an UnsupportedStatement:

        @Test
        void testCreate() throws JSQLParserException {
            String sqlStr =
                    "create trigger stud_marks before INSERT on Student for each row set Student.total = Student.subj1 + Student.subj2, Student.per = Student.total * 60 / 100";
            Statement statement = TestUtils.assertSqlCanBeParsedAndDeparsed(sqlStr, true);
            Assertions.assertTrue( statement instanceof UnsupportedStatement);
        }
  4. manticore-projects
    closed this as completedin 41b6fceon Jun 1, 2023
  5. manticore-projects
    closed this as completedin #1778on Jun 1, 2023
  6. manticore-projects
    added a commit that references this issue on Jun 15, 2023

    Assorted Fixes #8 (#1807)

    This issue will close once commit a815f5f is merged into the 'master' branch.
    a815f5f
  7. manticore-projects
    added a commit that references this issue on Jun 27, 2023

    Backslash Quotation of Single-Quote `'\\''` (#1813)

    This issue will close once commit c79dfff is merged into the 'master' branch.
    c79dfff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.