column order in SELECT * statement - guaranteed?

Viewed 5045

I am using an ORM (sqlalchemy) to fetch data from a PG database. I want to avoid specifying all the table column names in my hand crafted SQL statements*.

My assumption so far is that the returned columns are in the order of the DDL statements used to create the db tables. So far this is working - but I want to know if this is merely luck, or if it is specifically addressed in the (ANSI) SQL specification.

i.e. does ANSI SQL (and thus presumably the database) guarantee the order of columns returned in a SELECT * statement?

I am using PostgreSQL 8.4 as my backend db

  • yes, I am aware that using hand crafted SQL statements with an ORM defeats the purpose of an ORM, but needs must ...
1 Answers
Related