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

Offer a interface to reset column ordinal position by modifying metadata #66122

Open
bnuzhouwei opened this issue Jun 7, 2021 · 3 comments
Open

Comments

@bnuzhouwei
Copy link

@bnuzhouwei bnuzhouwei commented Jun 7, 2021

We do have the internal metadata concepts to make this happen in a relatively inexpensive way. That being said, we have not implemented this functionality. Please file a github issue to track it and discuss various design point. I will warn you that I don’t think this is something we’re in any hurry to implement. That issue can also be a way to gauge interest and work out syntax details. (by ajwerner, Andrew Werner, Roacher)

The process of designing software is gradual. In the DB design process, we can’t do a perfect solution that considerded all the properties for implement the business. Some columns may be added, if new columns can only at the end of columns list. The automancally generated db document will be inaesthetic and unnatural, that will cost must time to reposion them in Words or Excel.

Describe the solution you'd like

MSSQL also provide a GUI tool for reposition the columns by automancally recreate the table.
I think for CRDB is a NewSQL product with kv store, it is much easier to reposition columns without recreated table needed. May be just modify some metadata by (just like TiDB another NewSQL db):

alter table alter column columname after columnother

Describe alternatives you've considered

Or just updating the metabase:

update meta set attnum=@attnum where relname=@relname and attname=@attname
@blathers-crl
Copy link

@blathers-crl blathers-crl bot commented Jun 7, 2021

Hello, I am Blathers. I am here to help you get the issue triaged.

It looks like you have not filled out the issue in the format of any of our templates. To best assist you, we advise you to use one of these templates.

I have CC'd a few people who may be able to assist you:

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl blathers-crl bot added this to Incoming in KV Backlog Jun 7, 2021
@blathers-crl blathers-crl bot added this to Triage in SQL Schema Jun 7, 2021
@bnuboy
Copy link

@bnuboy bnuboy commented Jun 7, 2021

It is common to update the structure of the tables, thus it is very helpful for developers to modify the column ordinal position.

@jordanlewis jordanlewis removed this from Incoming in KV Backlog Jun 7, 2021
@ajwerner ajwerner moved this from Triage to Backlog in SQL Schema Jun 8, 2021
@ajwerner ajwerner moved this from Backlog to Cold storage in SQL Schema Jun 8, 2021
@manavchawla98
Copy link

@manavchawla98 manavchawla98 commented Jun 17, 2021

Hi! I'd like to help in solving this issue. Could you please give me some guidance on what part of the code to look at with some example use cases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
SQL Schema
  
Cold storage
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants