I did alter table rename to, and it did successfully and then when tried to create a new table with old name, it is saying table already exists but old table not showing in the table listing or cant retrieve data from old table.
I assume that this is all within the context of an explicit transaction, right? If so, I imagine you’re bumping up against sql: can't atomically swap names for catalog entries · Issue #54562 · cockroachdb/cockroach · GitHub. I’m interested in reconsidering this restriction; it has very good reasons for existing but may not be worth retaining. In any case, what I think you’re trying to do is not supported and is not likely to be supported until the 21.2 release at the very earliest.