Re:PostgreSQL is the worlds’ best database
by thequux on Friday April 03, 2020 @09:24AM
(#22768888)
I'll admit to not being an expert in databases, but I can't figure out why the order of columns in a database would be relevant, unless you're doing `select *` and indexing the resulting columns by number rather than name, which I've always found to be fragile to the point of being useless. What am I missing?
[ Parent
| on HN ]
It doesn't matter for coding or functionality, but it is nice when you're manually eyeballing the results of 'SELECT * ...' statements or browsing tables with something like Navicat, or looking at schema dumps - to have your fields ordered in some way that makes sense to you, rather than strictly in the order they were created.
Sure, you can list the fields in the order you want in a SELECT statement, but that's tedious - it's handy to have something reasonable in the table definition.
There's a wiki page on the Postgres site:
https://wiki.postgresql.org/wiki/Alter_column_position
talking about workarounds and a plan from 2006 on how they might implement that feature.