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

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

am 09.04.2008 15:50:44 von Potluri Srikanth


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. r>
     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)

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

am 09.04.2008 16:21:32 von Vyacheslav Kalinin

------=_Part_4363_17509020.1207750892229
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

try starting psql with -E (would show queries psql does) option and \d+ the
table

------=_Part_4363_17509020.1207750892229
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

try starting psql with -E (would show queries psql does) option and \d+ the table





------=_Part_4363_17509020.1207750892229--

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

am 10.04.2008 06:06:25 von Vishal Arora

--_42346998-9f4d-47eb-849a-8c318807eec1_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable






To: pgsql-admin@postgresql.orgDate: Wed, 9 Apr 2008 08:50:44 -0500Subject: =
[ADMIN] How do i get DDL of a Table from system catalog ?From: spotluri@ism=
artpanache.comHi,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. c=
reate table ext_table (like table_name); ------------------> this doesnot w=
ork for external tables.
=20
try - create table ext_table (like pg_catalog.table_name); - it worked for =
me.
=20
=20
2) so i need to query catalog to get definition of the table. on the =
basis of this definition i can create external table .eg: i am looking for =
some thing like : select * from pg_catalog where table_name=3D' srikanth_=
ext_parallel_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 for creation o=
f external table in a script which will run in cron job daily for data load=
ing.Can anyone guide/help me in this ?Regards, Srikanth k Potluri +63 91774=
44783(philippines)=20
____________________________________________________________ _____
Technology : Catch up on updates on the latest Gadgets, Reviews, Gaming and=
Tips to use technology etc.
http://computing.in.msn.com/=

--_42346998-9f4d-47eb-849a-8c318807eec1_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
















To: pgsql-admin@postgresql.org
Date: Wed, 9 Apr 2008 08:50:44 -0500
S=
ubject: [ADMIN] How do i get DDL of a Table from system catalog ?
From: =
spotluri@ismartpanache.com

Hi,

How do i get DDL of a Table fr=
om system catalog ?

Purpose :
1) i need to create an external tab=
le on the basis of  another table.
     create =
table ext_table (like table_name); ------------------> this doesnot work=
for external tables.

 

try - create table ext_table (like pg_catalog.table_n=
ame); - it worked for me.


 

 


2)  so i need to query catalog to get  definition of the tabl=
e.
     on the basis of this definition i can create exte=
rnal table .
eg: i am looking for some thing like :

   =
select * from pg_catalog where table_name=3D' srikanth_ext_parallel_crt_sms=
_logs_child_depth_1_d_2008_03_30_daily ' ;

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

=
Can anyone guide/help me in this ?



Regards,
Srikanth k P=
otluri
+63 9177444783(philippines)



Exc=
lusive Marriage Proposals!
Find UR life partner at Shaadi.com l.asp?pid=3D430' target=3D'_new'>Try it!
=

--_42346998-9f4d-47eb-849a-8c318807eec1_--