Remix.run Logo
Why It's So Hard to Add a Column in the Middle of a PostgreSQL Table(bytebase.com)
14 points by thunderbong 19 hours ago | 10 comments
HowTheStoryEnds 9 hours ago | parent | next [-]

> Product asks for an email column, and because you like a tidy schema, you want it right after name

But why? SQL is supposed to be declarative, the whole point is that you don't need to care about such trivia. Only when you care about the order in a _result_ do you specify so.

14 hours ago | parent | prev | next [-]
[deleted]
wolvoleo 14 hours ago | parent | prev | next [-]

Huh interesting. I've always preferred MySQL anyway though these days I obviously use Mariadb because Oracle.

lsaferite 14 hours ago | parent [-]

Out of curiosity, why do you prefer MySQL over Postgres?

wolvoleo 9 hours ago | parent [-]

Good question. I think it's because I just rolled into it. It was not really a conscious decision and after a while I got used to its quirks. And it got significantly better over time too of course.

audunw 12 hours ago | parent | prev | next [-]

“Here is the catch: that single integer is wearing three hats at once.”

How many times did that point have to be reiterated in unnecessary AI style?

Was the article AI generated. I hope so, if not it really shows how bad AI has degraded our ability to write. Could you at least have read over and cleaned up the prose a bit? That whole section could have been written in straight forward human language, and it would be shorter, clearer and less infuriating to read.

tianzhou 7 hours ago | parent [-]

Author here. I did use AI to assist writing. The way I do it is I feed all my past writings (around 200+ posts) to the AI and let it record my style.

I research the topic, lay the outlines and let AI write it. Then I further refine section by section with a combination of AI and manual editing).

What you have pointed out is valid and it helps me to improve the process. And I have edited the post based on your suggestion.

As a non-native speaker and engineer with 15+ database development experience, I think I will continue to use AI to assist writing (I rarely use AI if I write in my native language). This post still takes me almost an afternoon to finish, but without AI, it will take me much more time.

locknitpicker 4 hours ago | parent [-]

> This post still takes me almost an afternoon to finish, but without AI, it will take me much more time.

Why do you think people will bother reading something you didn't bothered to write?

rekabis 9 hours ago | parent | prev [-]

MSSQL Server has had this capability since forever.

You can even graphically drag-and-drop column order from within SSMS (SQL Server Management Studio), although it’s always seemed sketch AF to me, and I wouldn’t want to do this with a large table unless I had backups and the site/app was set offline due to maintenance.

Even Entity Framework (DotNet) has the ability to define column order, but only on table create (for sure). I cannot remember if an EF migration can insert a column anywhere into the middle or not.

pseudohadamard 8 hours ago | parent [-]

Is that because it's actually inserting/moving the new column at/to the given location or simply choosing to display it as being at that location? Given that one involves rewriting the entire database and the other involves swapping two entries when they're displayed, I know how I'd go it.