Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect the deleted database by default in the created "query-2.psql" file after executing "Create Function Query..." from command palette #2097

Open
v-xinda opened this issue Feb 8, 2023 · 3 comments
Labels
AT-CTI Created by CTI team enhancement Small changes that can slightly improve user experiences.

Comments

@v-xinda
Copy link

v-xinda commented Feb 8, 2023

OS: All
Build Version: 20230205.1

Repro Steps:

  1. Create a PostgreSQL account -> Create a database "Data01".
  2. Delete the database "Data01".
  3. F1 -> Click "Create Function Query..." -> Provide function name -> Select return type -> Enter.
  4. Check the created query-2.psql file.

Expect:
Connect an existing database or show "connect to database" (Like Scrapbook.mongo file) in the created query-2.psql file.
Screenshot 2023-02-08 at 17 00 36

Actual:

  1. Connect the deleted database "Data01" in the created query-2.psql file.

Screenshot 2023-02-08 at 17 00 09

2. An error occurs after clicking "Execute Query" in the created `query-2.psql` file.

Screenshot 2023-02-08 at 16 56 35

More Info:
This issue also reproduces for the stored procedures query.

@v-xinda v-xinda added the AT-CTI Created by CTI team label Feb 8, 2023
@alexweininger
Copy link
Member

Is this a regression?

@v-xinda
Copy link
Author

v-xinda commented Feb 9, 2023

@alexweininger No, it's not a regression. This issue also reproduces on the current release build.

@JasonYeMSFT
Copy link
Contributor

This is because deleting a postgres database requires first connecting to it, which will leave the deleted database in the cached connection data. A simple mitigation would be to always clear the connection after deleting a postgres database since we know it will always invalidate the current connection.

@JasonYeMSFT JasonYeMSFT added the enhancement Small changes that can slightly improve user experiences. label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AT-CTI Created by CTI team enhancement Small changes that can slightly improve user experiences.
Projects
None yet
Development

No branches or pull requests

3 participants