r/programming • u/jskatz05 • 5d ago
PostgreSQL 19 Released!
https://www.postgresql.org/about/news/postgresql-19-released-3449/32
u/X-lem 5d ago
Can we add a new column after another column yet?
12
u/leros 5d ago
I just want to reorder columns.
0
u/baseballlover723 5d ago
If you could reorder columns, then you could do this (and more), cause you could just add a column to the end and then immediately reorder it to where you want it.
14
u/halcyon_aporia 5d ago edited 5d ago
Why do people want this?
Edit: Huh, interesting. I literally never use a GUI with postgresql, so it never even occurred to me. Fair enough.
19
u/baseballlover723 5d ago
makes it easier to read when related columns are next to each other. Or are in some kind of grouping.
An easy scenario to image is you start with 1 metric column, say column 2 of 10. And then some years later you come up with another metric, and you want to see how it compares to your original metric. If it's in column 3, you can shift your eyes back and forth between them quite easily. If you have to cross 8 unrelated columns, then it's much less efficient for you to process the data.
And for the sake of argument, lets say that those 8 columns contain secondary information and the query takes some time to run, so simply omitting the other information also creates a big hassle.
6
u/badmonkey0001 5d ago
makes it easier to read when related columns are next to each other. Or are in some kind of grouping.
It also makes
CREATEstatements cleaner to read if anyone needs a non-GUI reason.7
u/halcyon_aporia 5d ago
You could always just run a select with the columns you want in the order you want, can't you? The result set will be in the order you select them.
11
u/baseballlover723 5d ago
I mean you could. But doing something every single time you want to use a * query (which is quite common for me) is a huge annoyance.
Just like how I could just type out my underlying view query every single time instead of just querying a view I wrote once.
Convenience is worth something imo. And needing to type out all of my columns for most of my queries is very inconvenient.
3
2
u/SenoraRaton 4d ago
I mean you could. But doing something every single time you want to use a * query (which is quite common for me) is a huge annoyance.
Store it as a view and access the view directly?
5
u/baseballlover723 4d ago
So then I have a table I never use, and a view that is virtually identical to the table I never use. And they both have to have names, which ideally describe them, but can't be the same.
I mean it works, but it doesn't feel like a good solution to me cause 2 things that apparently do the same thing is sure to cause confusion.
7
u/baseballlover723 5d ago
Edit: Huh, interesting. I literally never use a GUI with postgresql, so it never even occurred to me. Fair enough.
It's even more relevant in the CLI, where you don't get things like expandable cells or could potentially have a post query feature to rearrange things (though idk if any sql gui actually lets you do that).
Wrapping is a huge issue too. Imagine you have a table that stores reddit comments. There's a bunch of relevant fields, the id36, the username of who posted it, the body, when it was made, etc. If one of your middle fields has a very long width or has new lines in it, then everything after it can't be aligned and when one column is taking up 2-20 rows, it's really hard to read, because it's not very clear where one row starts and the next ends, or if it's in the middle of another column.
At least with a gui, you don't need to have all of the information being shown on the screen all the time, and you can simply show an excerpt of a really long cell, and have it expand on click etc.
4
2
2
u/ptman 1d ago
column order affects alignment and padding and can waste space: https://www.percona.com/blog/postgresql-column-alignment-and-padding-how-to-improve-performance-with-smarter-table-design/
3
36
u/AnderssonPeter 5d ago
Great i just upgraded from 17 to 18..
1
u/kre8tv 4d ago
Same ha from 16 to 18. I knew 19 was coming and was going to wait, but then it got delayed and then when launch was supposed to happen they said they found a bunch of bugs after an AI-review and had to drop features and that was going to take them time to fix. I thought maybe the delay would be months not weeks!
2
480
u/senatorium 5d ago
Neat.