Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aHH7a-0005Si-Av for pgsql-sql@arkaria.postgresql.org; Thu, 07 Jan 2016 20:25:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aHH7Z-00082E-QB for pgsql-sql@arkaria.postgresql.org; Thu, 07 Jan 2016 20:25:21 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aHH7X-00080c-SB for pgsql-sql@postgresql.org; Thu, 07 Jan 2016 20:25:20 +0000 Received: from nm49-vm1.bullet.mail.ne1.yahoo.com ([98.138.121.129]) by makus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aHH7V-0002au-G1 for pgsql-sql@postgresql.org; Thu, 07 Jan 2016 20:25:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s2048; t=1452198315; bh=SK7PZORUmScxulLoi4mEVLE7vp3vgowVWRRVYQDg9e4=; h=Date:From:Reply-To:To:Subject:References:From:Subject; b=I8zxIKnSThD2X2xLqZwvvbLN8ri0PBjmhOGupg1EQDhT6bEyr+8BqqOdpJhjRRNVfCCVPyqphgBekrKhLzPc7qjaU/Mi7Lk9tqH/HjI/rL98WTzdU3c0WcPK9zHZz8BgybatzHPGHxO7JYkUwxqEg55FWHkdFH8oQM8yjzHzHOCQlKqz90Cd6cCYBzTpbun7s2CjaQQgrzYWg56iczNjGQCW26EFAVIYnkJmAxmPE8bSvOvSdXj0vfLNteILBhn4cx6YR2+f0RBkIqcboFXsGKwer0NvFVv6ETlSVW2K7KhPTsfr8XPcjCGgF95ztggvQac6zkYdUykjV8iL5OgpXw== Received: from [127.0.0.1] by nm49.bullet.mail.ne1.yahoo.com with NNFMP; 07 Jan 2016 20:25:15 -0000 Received: from [98.138.226.178] by nm49.bullet.mail.ne1.yahoo.com with NNFMP; 07 Jan 2016 20:22:27 -0000 Received: from [98.139.214.32] by tm13.bullet.mail.ne1.yahoo.com with NNFMP; 07 Jan 2016 20:22:27 -0000 Received: from [98.139.212.192] by tm15.bullet.mail.bf1.yahoo.com with NNFMP; 07 Jan 2016 20:22:27 -0000 Received: from [127.0.0.1] by omp1001.mail.bf1.yahoo.com with NNFMP; 07 Jan 2016 20:22:27 -0000 X-Yahoo-Newman-Property: ymail-4 X-Yahoo-Newman-Id: 112256.72520.bm@omp1001.mail.bf1.yahoo.com X-YMail-OSG: 5gex1YcVM1nl1Dg6x7bxzdD5nebq6SFWugempmOz7rYFcKzCxy_h.NUjvWT2nzT QLaqIO8FRUMq7_H5bBAd9pL3WH_Ee2RCEiNT6VH6RkbCvZtwN7BQOadN2znvqokWsNDh4_FgwP4c LcOCi6eUrLevPzp2q1AAQCN0arPjh91VuXxu._OojD_rcX83eHNWB4bidBOGCwB20GmYHOPGBoT1 1bg1OteRWzAEPoM7TLCH._vy7ZBYehpXmtGLMI1VZoRkCwBjV6DNXcB7sEx8nh5DLlHwoFqwI6k. dxJsktGF2un2YVBUU6Wch3RV3To2VBz5dEzJDSLgQBt_3o0dx7JOCAmiCzJh.C06zacNJbbex1RJ czwZ78BoPJ_F67SG9Y8e2cXI3gChCs1vU58xZbX1fe4Rdn.aXre_M4s3OpN7kbH_lN7A6.tf0zUT cH18PYa.LJhi.SZG0sv3utZs4pzM.Qb84QJf60LZnXIGUuJqkAAHh.QlvTuFRhxCoOYfsuINwfGt SbAiQh8Fx97XdiNmB6nxv67xwHTJkXhzjrKSJ82Czm3qze5ETRPW_4xSN.kE_ZSdiVyxesXWeZg-- Received: by 66.196.80.122; Thu, 07 Jan 2016 20:22:26 +0000 Date: Thu, 7 Jan 2016 20:22:26 +0000 (UTC) From: Eugene Yin Reply-To: Eugene Yin To: "pgsql-sql@postgresql.org" Message-ID: <751099510.1801394.1452198146367.JavaMail.yahoo@mail.yahoo.com> Subject: To get the column names, data types, and nullables of tables in the schema owned by MASTER_USER MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1801393_1918132524.1452198146359" References: <751099510.1801394.1452198146367.JavaMail.yahoo.ref@mail.yahoo.com> Content-Length: 13887 X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org ------=_Part_1801393_1918132524.1452198146359 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable PostgreSQL ver: 9.4.5 =C2=A0 =C2=A0 =C2=A0 =C2=A0 OS: LinuxGOAL: To get the= column names, data types, and nullables of tables in the schema owned by M= ASTER_USERIn Oracle, I can use the following statement:select=20 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 =3D t.table_name AND cons.constraint_type =3D 'P' AND cons.constraint_name =3D col.constraint_name AND cons.owner =3D col.owner and cons.owner =3D 'MA= STER_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 =C2=A0on= Postgres? ThanksEugene ------=_Part_1801393_1918132524.1452198146359 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
PostgreSQL ver: 9.4.5 =         OS: Linux
GOAL: To get the column names, data types, and nullables of tables in= the schema owned by MASTER_USER
= In Oracle, I can use the following statement:
select=20
    t.table_name,
    t.column_name,
    t.data_type,
    t.NULLABLE,
    (SELECT col.column_name
     FROM all_constraints co=
ns, all_cons_columns col
     WHERE col.table_name =3D t.table_name
                        AND =
cons.constraint_type =3D 'P'
                        AND =
cons.constraint_name =3D col.constraint_name
                        AND =
cons.owner =3D col.owner a=
nd cons<=
span class=3D"" style=3D"margin: 0px; padding: 0px; border: 0px; color: rgb=
(0, 0, 0);" id=3D"yui_3_16_0_1_1452135740077_68799">.owner =3D 'MASTER_USER'
    )  Primary_Key_Column
from user_tab_columns t= ;
Now, I am on Postgres (9.4.5). = How can I convert the above statement into the equivalent SQL  on Post= gres?

Thanks
Eugen= e
=
------=_Part_1801393_1918132524.1452198146359--