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

show create table as of shows the wrong statement for a dropped view/table with same name #8533

Closed
tbantle22 opened this issue Nov 5, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@tbantle22
Copy link
Contributor

tbantle22 commented Nov 5, 2024

Create table and view on main

testshow % dolt sql -q "create table test (id int primary key);"
testshow % dolt sql -q "create view tview as select * from test;"
testshow % dolt commit -Am "first"
commit 6cmtn081tm7ud56fig67htj2l93jb3m2 (HEAD -> main)
Author: tbantle <[email protected]>
Date:  Tue Nov 05 14:27:46 -0800 2024

        first

Drop view and create table of same name on new branch

testshow % dolt checkout -b branchview
Switched to branch 'branchview'
testshow % dolt sql -q 'drop view tview'
testshow % dolt commit -Am 'drop view'
commit q9v5qvh5dtlv1u68jhih44mdau9k96gl (HEAD -> branchview)
Author: tbantle <[email protected]>
Date:  Tue Nov 05 15:34:56 -0800 2024

        drop view

testshow % dolt sql -q 'create table tview (id int primary key)'
testshow % dolt commit -Am 'create table'
commit mppn5bme2f5t82j2f1hlmg9n8h0n7rl9 (HEAD -> branchview)
Author: tbantle <[email protected]>
Date:  Tue Nov 05 15:35:16 -0800 2024

        create table

show create table has expected output on branchview for the latest commit

testshow % dolt sql -q 'show create table tview'
+-------+------------------------------------------------------------------+
| Table | Create Table                                                     |
+-------+------------------------------------------------------------------+
| tview | CREATE TABLE `tview` (                                           |
|       |   `id` int NOT NULL,                                             |
|       |   PRIMARY KEY (`id`)                                             |
|       | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin |
+-------+------------------------------------------------------------------+

But if I check out main and show create table as of [commit table was created] it shows a create view statement instead of create table statement

testshow % dolt checkout main
Switched to branch 'main'
testshow % dolt sql -q 'show create table tview as of branchview'
+-------+-------------------------------------------+----------------------+----------------------+
| View  | Create View                               | character_set_client | collation_connection |
+-------+-------------------------------------------+----------------------+----------------------+
| tview | CREATE VIEW `tview` AS select * from test | utf8mb4              | utf8mb4_0900_bin     |
+-------+-------------------------------------------+----------------------+----------------------+
@tbantle22 tbantle22 added the bug Something isn't working label Nov 5, 2024
@jycor jycor closed this as completed Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants