Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-21462

Sql. Allow using DEFAULT in UPDATE statements.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • sql
    • Docs Required, Release Notes Required

    Description

      According to SQL standard update statement also allows to specify DEFAULT in addition to an expression:

      @Test
      public void testUpdateDefault() {
         sql("CREATE TABLE t (id INTEGER PRIMARY KEY, val INTEGER DEFAULT 42)");
         sql("INSERT INTO t VALUES(1, 0)");
         sql("UPDATE t SET val = DEFAULT WHERE id = 1");// should work
       }
      

      But SQL parser can not parse such statement an returns an error:

      Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-5 TraceId:90bce644-7799-4b0e-b132-60b26e7ba2da Failed to parse query: Incorrect syntax near the keyword 'DEFAULT' at line 1, column 20
      	at org.apache.ignite.internal.sql.engine.sql.IgniteSqlParser.convertException(IgniteSqlParser.java:203)
      	at org.apache.ignite.internal.sql.engine.sql.IgniteSqlParser.parse(IgniteSqlParser.java:112)
      	at org.apache.ignite.internal.sql.engine.sql.IgniteSqlParser.parse(IgniteSqlParser.java:77)
      	at org.apache.ignite.internal.sql.engine.sql.ParserServiceImpl.parse(ParserServiceImpl.java:65)
      	at org.apache.ignite.internal.sql.engine.SqlQueryProcessor.lambda$querySingle0$10(SqlQueryProcessor.java:572)
      	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
      	... 6 more
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mzhuravkov Maksim Zhuravkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: