Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 86B392E003D for ; Wed, 9 Apr 2008 10:51:03 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 04224-03 for ; Wed, 9 Apr 2008 10:50:38 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from app02.sm.onr.chicago.hostway (fw.mfg.onr.siteprotect.com [64.26.60.152]) by developer.postgresql.org (Postfix) with ESMTP id AEAA12E0038 for ; Wed, 9 Apr 2008 10:50:46 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by app02.sm.onr.chicago.hostway (Postfix) with ESMTP id AAC77C4123 for ; Wed, 9 Apr 2008 08:50:44 -0500 (CDT) MIME-Version: 1.0 X-Mailer: AtMail PHP 5.04 Message-ID: <41734.1207749044@ismartpanache.com> To: Reply-To: spotluri@ismartpanache.com Content-Type: text/html; charset="utf-8" X-Origin: 121.97.28.3 Date: Wed, 9 Apr 2008 08:50:44 -0500 Subject: How do i get DDL of a Table from system catalog ? From: "Potluri Srikanth" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.673 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001, MIME_HTML_ONLY=1.672 X-Spam-Level: * X-Archive-Number: 200804/89 X-Sequence-Number: 28853 Hi,

How do i get DDL of a Table from system catalog ?

Purpose :
1) i need to create an external table on the basis of  another table.<= br>      create table ext_table (like table_name); --------= ----------> this doesnot work for external tables.
2)  so i need to query catalog to get  definition of the table.      on the basis of this definition i can create external t= able .
eg: i am looking for some thing like :

   select * from pg_catalog where table_name=3D' srikanth_ext_par= allel_crt_sms_logs_child_depth_1_d_2008_03_30_daily ' ;

3) once i get the definition of the table , i need to use that definition f= or creation of external table in a script which will run in cron job daily = for data loading.

Can anyone guide/help me in this ?



Regards,
Srikanth k Potluri
+63 9177444783(philippines)