Can You Drop a Column in Aurora DSQL?
Asked by
spare shoelace
I've been experimenting with DSQL and tried using the standard SQL command to drop a column: `ALTER TABLE mytable DROP COLUMN mycolumn;`. However, I got an error saying that this command isn't supported. From what I can gather from the documentation, it seems that the only modification I can make to a table is adding columns, not dropping them. Is that correct? If so, why is the `DROP` function not available?
Answers
I havenโt tried DSQL yet, but it appears that removing a column is just a feature they haven't added yet. Itโs strange not to have that flexibility, especially since everyone has different needs. Still, in production, how often do you really need to remove columns? It seems that itโs not a frequent use case for most people.
Reply to this answer
Yeah, you're right about that. It seems like a pretty basic SQL command, but dropping a column in a production environment can lead to significant issues like table locks and cascading effects. So, I understand why Aurora DSQL doesn't support it. When you're scaling up, the best strategy is often to just remove the column from your queries and treat it as if it's gone, or plan a more complicated table copy and replace if you need to.
Reply to this answer
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions