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

Move DDL 'IF EXISTS` flag handling inside the catalog command

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • sql

    Description

      Currently, the catalog command itself does not handle the 'IF EXISTS' 'IF NOT EXISTS' flags. We handle the exception thrown by the command and set the result to false if the flag was set. And this result (true/false) can be obtained by the user using AsyncResultSet#wasApplied method.

      With the current approach, a problem may arise when processing a batch command.
      For example

      CREATE TABLE IF NOT EXISTS Person...   -- command 1
      CREATE TABLE IF NOT EXISTS City...     -- command 2
      

      If the Person table exists, the batch will not be fully executed.

      To address this we can move flag handling inside the command itself.
      To keep "wasApplied" working, we can rework a bit CatalogManager#execute so that it returns not only the catalog version, but also a flag indicating that something was changed when this command was executed.

      Attachments

        Activity

          People

            Unassigned Unassigned
            xtern Pavel Pereslegin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: