Answers for "postgresql rearrange order"

SQL
0

postgres reorder columns

PostgreSQL currently defines column order based on the attnum column of the pg_attribute table. The only way to change column order is either by recreating the table, or by adding columns and rotating data until you reach the desired layout.
    
    ----
    
    CREATE VIEW original_tab_vw AS
    SELECT a.col1, a.col3, a.col4, a.col2
    FROM original_tab a
    WHERE a.col1 IS NOT NULL --or whatever
Posted by: Guest on September-23-2021

Code answers related to "postgresql rearrange order"

Code answers related to "SQL"

Browse Popular Code Answers by Language