Thread: Data Dictionary

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2016
    Posts
    1
    Rep Power
    0

    Data Dictionary


    Planning to migrate to PostgreSQL from Oracle.

    In Oracle, I can

    Code:
    select utc.table_name, 
                    utc.column_name, 
                    utc.data_type,
                    utc.NULLABLE, 
                      (SELECT cols.column_name 
                        FROM all_constraints cons, all_cons_columns cols
                        WHERE cols.table_name = utc.table_name
                        AND cons.constraint_type = 'P'
                        AND cons.constraint_name = cols.constraint_name
                        AND cons.owner = cols.owner and cons.owner = 'MASTER'
                      )  
                    Primary_Key_Column
            from user_tab_columns utc;

    What would be the equivalent SQL on Postgres?



    Thanks

    Eugene
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    Paris Uppland
    Posts
    2,402
    Rep Power
    394
    Use the views in the schema information:_schema. In your case, the view columns is apropriate.

IMN logo majestic logo threadwatch logo seochat tools logo