How to get the normal order of table by select column_name (PostgreSQL)?
As stated in the documentation there is a ordinal_position
column in table information_schema.columns
.
So just order by ordinal_position
:
SELECT
column_name
FROM
INFORMATION_SCHEMA.Columns
WHERE
table_name = 'table1'
ORDER BY
ordinal_position