You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jane Chan (Jira)" <ji...@apache.org> on 2022/10/18 09:07:00 UTC

[jira] [Created] (FLINK-29677) DROP CATALOG statement does not reset current catalog

Jane Chan created FLINK-29677:
---------------------------------

             Summary: DROP CATALOG statement does not reset current catalog 
                 Key: FLINK-29677
                 URL: https://issues.apache.org/jira/browse/FLINK-29677
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / API
    Affects Versions: 1.14.6, 1.15.2
            Reporter: Jane Chan
         Attachments: image-2022-10-18-16-55-38-525.png, image-2022-10-18-17-02-30-318.png

h3. Issue Description

Currently, the drop catalog statement

 
{code:java}
DROP CATALOG my_cat{code}
 

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

 
{code:java}
SHOW CURRENT CATALOG
SHOW CATALOGS
{code}
 
h3. How to Reproduce

!image-2022-10-18-16-55-38-525.png|width=444,height=421!

 
h3. 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.

!image-2022-10-18-17-02-30-318.png|width=288,height=435!

 

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]  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)