Hi,
Joolz, you already got quite a few answers, that the frontend is probably
not properly designed, if it relies on a certain column ordering. I agree
completely with that. However your question got me curious, and I've digged
around a bit in the system tables. You might be interested in my findings.
See below.
Citing Joolz <joolz@arbodienst-limburg.nl>:
> I agree. Only I think this wouldn't require new functionality, I
> have a gut feeling that this is possible as it is. Now only find out
> how :)
>
> I'll have a look at the system tables (that's where the answer must
> be) but maybe someone who has done this can save me the time...
If you do:
set search_path=information_schema;
\d columns
and look at the Columns defined, you'll find a column called ordinal_position,
which incidentally corresponds to the position of the columns on output. If
you dig a bit further and look at the definition of the columns view, you'll
find, that this column comes from a column attnum in pg_attribute. As
database superuser, you can actually change the values of attnum, however
doing so results in:
ERROR: invalid memory alloc request size 4294967295
on queries on the tables for which you changed attnum. So:
1.) obviously PostgreSQL does not like it at all (at least on my platform,
which is OpenBSD 3.6)
2.) I wouldn't risk messing with a system table, which I can only write to
if I'm superuser if I don't completely understand what's happening
behind the scenes (at least not for production use).
3.) changing that behaviour is probably a lot more work than changing the
frontend.
Regards,
Daniel