To get the column names, data types, and nullables of tables in the schema owned by MASTER_USER

From: Eugene Yin <eugeneymail(at)ymail(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: To get the column names, data types, and nullables of tables in the schema owned by MASTER_USER
Date: 2016-01-07 20:22:26
Message-ID: 751099510.1801394.1452198146367.JavaMail.yahoo@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

PostgreSQL ver: 9.4.5         OS: LinuxGOAL: To get the column names, data types, and nullables of tables in the schema owned by MASTER_USERIn Oracle, I can use the following statement:select
t.table_name,
t.column_name,
t.data_type,
t.NULLABLE,
(SELECT col.column_name
FROM all_constraints cons, all_cons_columns col
WHERE col.table_name = t.table_name
AND cons.constraint_type = 'P'
AND cons.constraint_name = col.constraint_name
AND cons.owner = col.owner and cons.owner = 'MASTER_USER'
) Primary_Key_Columnfrom user_tab_columns t;Now, I am on Postgres (9.4.5). How can I convert the above statement into the equivalent SQL  on Postgres?
ThanksEugene

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message michael@sqlexec.com 2016-01-07 20:27:13 Re: public synonym
Previous Message Eugene Yin 2016-01-07 20:17:40 public synonym