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

Column rename through CHANGE COLUMN changes column order #1677

Open
Luit opened this issue Jun 13, 2022 · 2 comments
Open

Column rename through CHANGE COLUMN changes column order #1677

Luit opened this issue Jun 13, 2022 · 2 comments
Labels

Comments

@Luit
Copy link

Luit commented Jun 13, 2022

Version

1.14.0

What happened?

After I noticed #1605 was added to 1.14 I ran the new version against our code, as I know there's a few CHANGE COLUMN statements in there. I noticed the ones that don't change the name are also impacted by this change, as they're pulled down to the last position in the column list it seems.

I only tested this with our own code against a MariaDB. In my case, column order doesn't change when CHANGE COLUMN is used to change type, change name, or both.

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

No response

What operating system are you using?

Linux

What database engines are you using?

MySQL

What type of code are you generating?

Go

@Luit Luit added bug Something isn't working triage New issues that hasn't been reviewed labels Jun 13, 2022
@kyleconroy kyleconroy added question Further information is requested and removed triage New issues that hasn't been reviewed labels Aug 29, 2022
@kyleconroy
Copy link
Collaborator

@Luit What impact does the ordering of the columns have on your queries?

@Luit
Copy link
Author

Luit commented Aug 29, 2022

I noticed this caused a diff on my structs even though nothing functionally changed. I'm not entirely sure whether sqlc actually maintains column order similar to how MariaDB(/MySQL) does this, but so far column order and struct order was the same for our cases. If ADD COLUMN x AFTER y doesn't have an impact on struct order either, then I'm not sure this one is important either.

@kyleconroy kyleconroy removed the question Further information is requested label Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants