From bp@interaction.ws Tue Nov 16 14:02:34 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C3E0D3A3C89 for ; Tue, 16 Nov 2004 14:02:34 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34134-08 for ; Tue, 16 Nov 2004 14:02:29 +0000 (GMT) Received: from mail.interaction.ws (unknown [216.46.25.69]) by svr1.postgresql.org (Postfix) with ESMTP id 7ABA13A3C21 for ; Tue, 16 Nov 2004 14:02:31 +0000 (GMT) Received: from BRUNO2500 ([192.168.0.93]) by mail.interaction.ws (8.11.6/8.11.6) with SMTP id iAGE2U200644 for ; Tue, 16 Nov 2004 09:02:30 -0500 Message-ID: <02ac01c4cbe5$2effc580$5d00a8c0@BRUNO2500> From: =?utf-8?Q?Bruno_Pr=C3=A9vost?= To: Subject: Table definition Date: Tue, 16 Nov 2004 09:04:26 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_02A9_01C4CBBB.4611EFC0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.5 tagged_above=0.0 required=5.0 tests=HTML_40_50, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200411/145 X-Sequence-Number: 19464 This is a multi-part message in MIME format. ------=_NextPart_000_02A9_01C4CBBB.4611EFC0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Les consultants Interaction | stationery Hi, Anybody know how to obtain the table definition in text. Something like "select definition from pg_catalog.pg_views where = viewname =3D 'xxx'" but for a table. Thanks Bruno ------=_NextPart_000_02A9_01C4CBBB.4611EFC0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable =EF=BB=BF Les consultants Interaction | stationery
 
Hi,
Anybody know how to obtain the table definition in text.
Something like "select definition from pg_catalog.pg_views where = viewname =3D=20 'xxx'" but for a table.
Thanks
Bruno
 
------=_NextPart_000_02A9_01C4CBBB.4611EFC0-- From gparuchuri@oneil.com Tue Nov 16 15:11:12 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 38C343A4039 for ; Tue, 16 Nov 2004 15:11:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61168-08 for ; Tue, 16 Nov 2004 15:11:06 +0000 (GMT) Received: from meridius.oneil.com (meridius.oneil.com [66.194.184.36]) by svr1.postgresql.org (Postfix) with ESMTP id DCBFF3A3FA8 for ; Tue, 16 Nov 2004 15:11:09 +0000 (GMT) Received: from [192.168.1.20] ([192.168.1.20]:49160 "EHLO daytonnt20.oneilinc.net" ident: "NO-IDENT-SERVICE[2]") by meridius.oneil.com with ESMTP id ; Tue, 16 Nov 2004 10:11:09 -0500 Received: from DAYTONEX.oneilinc.net (unverified) by daytonnt20.oneilinc.net (Content Technologies SMTPRS 4.3.14) with ESMTP id for ; Tue, 16 Nov 2004 10:07:21 -0500 X-MIMEOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C4CBED.F8C958B5" Subject: Re: Table definition Date: Tue, 16 Nov 2004 10:07:21 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] Table definition Thread-Index: AcTL5wmva8bnkgvQSjy1fwb3iL1EnwABrbww From: "Goutam Paruchuri" To: =?iso-8859-1?Q?Bruno_Pr=E9vost?= , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.9 tagged_above=0.0 required=5.0 tests=HTML_30_40, HTML_FONTCOLOR_BLUE, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200411/146 X-Sequence-Number: 19465 This is a multi-part message in MIME format. ------_=_NextPart_001_01C4CBED.F8C958B5 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Probably there is no direct way get the definition (i could not find one at= least). You can probably write a custom function which gives all columns, indexes a= nd formulate a create table statement (text definition). =20 Let us know if you find a way out. =20 - Goutam =20 ________________________________ From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.or= g] On Behalf Of Bruno Pr=E9vost Sent: Tuesday, November 16, 2004 9:04 AM To: pgsql-sql@postgresql.org Subject: [SQL] Table definition =09 =09 =20 Hi, Anybody know how to obtain the table definition in text. Something like "select definition from pg_catalog.pg_views where viewname = =3D 'xxx'" but for a table. Thanks Bruno =20 Confidentiality Notice The information contained in this e-mail is confidential and intended for u= se only by the person(s) or organization listed in the address. If you have= received this communication in error, please contact the sender at O'Neil = & Associates, Inc., immediately. Any copying, dissemination, or distributio= n of this communication, other than by the intended recipient, is strictly = prohibited. ------_=_NextPart_001_01C4CBED.F8C958B5 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Les consultants Interaction | stationery
Probably there is no direct way get the definition= (i could=20 not find one atleast).
You can probably write a custom function which giv= es all=20 columns, indexes and formulate a create table statement (text=20 definition).
 
Let us know if you find a way out.
 
- Goutam

 

From: pgsql-sql-owner@postgresql.org= [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Bruno=20 Pr=E9vost
Sent: Tuesday, November 16, 2004 9:04 AM
To:=20 pgsql-sql@postgresql.org
Subject: [SQL] Table=20 definition

 
Hi,
Anybody know how to obtain the table definition in text.
Something like "select definition from pg_catalog.pg_views where vie= wname=20 =3D 'xxx'" but for a table.
Thanks
Bruno
 


Confidentiality Notice
The information contained in this e-mail is confidential and intended for u= se only by the person(s) or organization listed in the address. If you have= received this communication in error, please contact the sender at O'Neil = & Associates, Inc., immediately. Any copying, dissemination, or distributio= n of this communication, other than by the intended recipient, is strictly = prohibited.
------_=_NextPart_001_01C4CBED.F8C958B5-- From peter_e@gmx.net Tue Nov 16 15:16:55 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 974433A4001 for ; Tue, 16 Nov 2004 15:16:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63108-07 for ; Tue, 16 Nov 2004 15:16:48 +0000 (GMT) Received: from curie.credativ.org (credativ.com [217.160.209.18]) by svr1.postgresql.org (Postfix) with ESMTP id 2D7F83A4013 for ; Tue, 16 Nov 2004 15:16:51 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by curie.credativ.org (Postfix) with ESMTP id CE1A0564AB; Tue, 16 Nov 2004 16:16:51 +0100 (CET) Received: from www.credativ.de (pD95014D0.dip0.t-ipconnect.de [217.80.20.208]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by curie.credativ.org (Postfix) with ESMTP id 0979B5598A; Tue, 16 Nov 2004 16:16:50 +0100 (CET) Received: from bell.credativ.de (bell.credativ.de [172.26.14.16]) by www.credativ.de (Postfix) with ESMTP id 884D61C0029; Tue, 16 Nov 2004 16:16:49 +0100 (CET) From: Peter Eisentraut To: Bruno =?iso-8859-15?q?Pr=E9vost?= Subject: Re: Table definition Date: Tue, 16 Nov 2004 16:16:48 +0100 User-Agent: KMail/1.6.2 Cc: References: <02ac01c4cbe5$2effc580$5d00a8c0@BRUNO2500> In-Reply-To: <02ac01c4cbe5$2effc580$5d00a8c0@BRUNO2500> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Message-Id: <200411161616.48196.peter_e@gmx.net> X-Virus-Scanned: by AMaViS at credativ.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/147 X-Sequence-Number: 19466 Am Dienstag, 16. November 2004 15:04 schrieb Bruno Prévost: > Anybody know how to obtain the table definition in text. Use pg_dump. -- Peter Eisentraut http://developer.postgresql.org/~petere/ From sam@samason.me.uk Tue Nov 16 15:29:32 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3C2BA3A40C0 for ; Tue, 16 Nov 2004 15:29:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67477-07 for ; Tue, 16 Nov 2004 15:29:22 +0000 (GMT) Received: from outmail.freedom2surf.net (outmail1.freedom2surf.net [194.106.33.237]) by svr1.postgresql.org (Postfix) with ESMTP id 5E0AA3A40BC for ; Tue, 16 Nov 2004 15:29:24 +0000 (GMT) Received: from sam.samason.me.uk (sam.samason.me.uk [195.137.31.118]) by outmail.freedom2surf.net (8.12.10/8.12.10) with ESMTP id iAGFTNnF026714 for ; Tue, 16 Nov 2004 15:29:23 GMT Received: by sam.samason.me.uk (Postfix, from userid 1000) id 5F8EA636BB; Tue, 16 Nov 2004 15:29:23 +0000 (GMT) Date: Tue, 16 Nov 2004 15:29:23 +0000 From: Sam Mason To: pgsql-sql@postgresql.org Subject: Re: Table definition Message-ID: <20041116152923.GY25775@sam.samason.me.uk> Mail-Followup-To: pgsql-sql@postgresql.org References: <02ac01c4cbe5$2effc580$5d00a8c0@BRUNO2500> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <02ac01c4cbe5$2effc580$5d00a8c0@BRUNO2500> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/148 X-Sequence-Number: 19467 Bruno Prévost wrote: >Anybody know how to obtain the table definition in text. Not quite sure if this is quite what you're after, but would: $ pg_dump -st foo help at all? It gives out the SQL that you would need to enter to re-create the table. Sam From bp@interaction.ws Tue Nov 16 15:38:26 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BDAFE3A40E8 for ; Tue, 16 Nov 2004 15:38:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72317-05 for ; Tue, 16 Nov 2004 15:38:13 +0000 (GMT) Received: from mail.interaction.ws (unknown [216.46.25.69]) by svr1.postgresql.org (Postfix) with ESMTP id 4BF953A40A6 for ; Tue, 16 Nov 2004 15:38:14 +0000 (GMT) Received: from BRUNO2500 ([192.168.0.93]) by mail.interaction.ws (8.11.6/8.11.6) with SMTP id iAGFc6200954; Tue, 16 Nov 2004 10:38:06 -0500 Message-ID: <03bd01c4cbf2$8a8babf0$5d00a8c0@BRUNO2500> From: =?ISO-8859-15?Q?Bruno_Pr=E9vost?= To: "Peter Eisentraut" Cc: References: <02ac01c4cbe5$2effc580$5d00a8c0@BRUNO2500> <200411161616.48196.peter_e@gmx.net> Subject: Re: Table definition Date: Tue, 16 Nov 2004 10:40:03 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-15"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/149 X-Sequence-Number: 19468 I need to use it in sql. Thk Bruno ----- Original Message ----- From: "Peter Eisentraut" To: "Bruno Prévost" Cc: Sent: Tuesday, November 16, 2004 10:16 AM Subject: Re: [SQL] Table definition > Am Dienstag, 16. November 2004 15:04 schrieb Bruno Prévost: >> Anybody know how to obtain the table definition in text. > > Use pg_dump. > > -- > Peter Eisentraut > http://developer.postgresql.org/~petere/ > From peter_e@gmx.net Tue Nov 16 16:14:03 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C5CF83A3B6B for ; Tue, 16 Nov 2004 16:14:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86154-07 for ; Tue, 16 Nov 2004 16:13:59 +0000 (GMT) Received: from curie.credativ.org (credativ.com [217.160.209.18]) by svr1.postgresql.org (Postfix) with ESMTP id 9326A3A3C42 for ; Tue, 16 Nov 2004 16:13:59 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by curie.credativ.org (Postfix) with ESMTP id 05AC6564AE; Tue, 16 Nov 2004 17:13:56 +0100 (CET) Received: from www.credativ.de (pD95014D0.dip0.t-ipconnect.de [217.80.20.208]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by curie.credativ.org (Postfix) with ESMTP id 901F3564AF; Tue, 16 Nov 2004 17:13:42 +0100 (CET) Received: from bell.credativ.de (bell.credativ.de [172.26.14.16]) by www.credativ.de (Postfix) with ESMTP id 0BDE11C0029; Tue, 16 Nov 2004 17:13:36 +0100 (CET) From: Peter Eisentraut To: Bruno =?iso-8859-15?q?Pr=E9vost?= Subject: Re: Table definition Date: Tue, 16 Nov 2004 17:13:34 +0100 User-Agent: KMail/1.6.2 Cc: References: <02ac01c4cbe5$2effc580$5d00a8c0@BRUNO2500> <200411161616.48196.peter_e@gmx.net> <03bd01c4cbf2$8a8babf0$5d00a8c0@BRUNO2500> In-Reply-To: <03bd01c4cbf2$8a8babf0$5d00a8c0@BRUNO2500> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Message-Id: <200411161713.34830.peter_e@gmx.net> X-Virus-Scanned: by AMaViS at credativ.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/150 X-Sequence-Number: 19469 Am Dienstag, 16. November 2004 16:40 schrieb Bruno Prévost: > I need to use it in sql. There is no direct way to do this in SQL, but I can offer you the following alternative: CREATE FUNCTION get_table_definition(text) RETURNS text AS ' #!/bin/sh pg_dump -t $1 ' LANGUAGE plsh; :) -- Peter Eisentraut http://developer.postgresql.org/~petere/ From bp@interaction.ws Tue Nov 16 16:47:29 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A4B333A3D32 for ; Tue, 16 Nov 2004 16:47:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99045-09 for ; Tue, 16 Nov 2004 16:47:20 +0000 (GMT) Received: from mail.interaction.ws (unknown [216.46.25.69]) by svr1.postgresql.org (Postfix) with ESMTP id 3DFCB3A3D0B for ; Tue, 16 Nov 2004 16:47:19 +0000 (GMT) Received: from BRUNO2500 ([192.168.0.93]) by mail.interaction.ws (8.11.6/8.11.6) with SMTP id iAGGlE201316; Tue, 16 Nov 2004 11:47:14 -0500 Message-ID: <044a01c4cbfc$330306d0$5d00a8c0@BRUNO2500> From: =?ISO-8859-15?Q?Bruno_Pr=E9vost?= To: "Peter Eisentraut" Cc: References: <02ac01c4cbe5$2effc580$5d00a8c0@BRUNO2500> <200411161616.48196.peter_e@gmx.net> <03bd01c4cbf2$8a8babf0$5d00a8c0@BRUNO2500> <200411161713.34830.peter_e@gmx.net> Subject: Re: Table definition Date: Tue, 16 Nov 2004 11:49:11 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-15"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/151 X-Sequence-Number: 19470 It could help me, but pg_dump give all foreigns key and index creation. I'm not sure if it's not better to write a custom function in plpgsql. Bruno ----- Original Message ----- From: "Peter Eisentraut" To: "Bruno Prévost" Cc: Sent: Tuesday, November 16, 2004 11:13 AM Subject: Re: [SQL] Table definition > Am Dienstag, 16. November 2004 16:40 schrieb Bruno Prévost: >> I need to use it in sql. > > There is no direct way to do this in SQL, but I can offer you the > following > alternative: > > CREATE FUNCTION get_table_definition(text) RETURNS text AS ' > #!/bin/sh > pg_dump -t $1 > ' LANGUAGE plsh; > > :) > > -- > Peter Eisentraut > http://developer.postgresql.org/~petere/ >