Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-29677

Prevent dropping the current catalog

    XMLWordPrintableJSON

Details

    Description

      Issue Description

      Currently, the drop catalog statement

       

      DROP CATALOG my_cat

       

      does not reset the current catalog. As a result, if dropping a catalog in use, then the following statements will yield different results.

       

      SHOW CURRENT CATALOG
      SHOW CATALOGS
      

       

      How to Reproduce

       

      Proposed Fix Plan

      The root cause is that `CatalogManager#unregisterCatalog` does not reset `currentCatalogName`. 

      Regarding this issue, I checked MySQL and PG's behavior.

      For MySQL, it is allowed to drop a database current-in-use and set the current database to NULL.

       

      For PG, it is not allowed to drop the database currently in use.

       

      I think both behaviors are reasonable, while for simplicity I suggest adhering to PG, that throw an Exception when dropping the current catalog.

      cc jark  fsk119  

      Attachments

        1. image-2022-10-18-16-55-38-525.png
          165 kB
          Jane Chan
        2. image-2022-10-18-17-02-30-318.png
          200 kB
          Jane Chan

        Issue Links

          Activity

            People

              qingyue Jane Chan
              qingyue Jane Chan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: