B
B
Banny_Boom2015-06-03 19:33:18
PHP
Banny_Boom, 2015-06-03 19:33:18

How to swap fields in a postgreSQL table?

How can I swap fields in a PostgreSQL database?
I use:
1. phpPgAdmin.
2.PgAdmin.
What for? - it so happened that I forgot the id field and created it after creating the table and now it is at the very bottom ..
This is not convenient.
Is it possible to change the position of the field somehow using standard methods?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2015-06-03
@Banny_Boom

recreate the table on a new one or create a view with the desired position of the columns.
both methods are described here .

T
t3946, 2020-08-01
@t3946

Alternatively: SELECT id, name INTO id_name_table FROM name_id_table;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question