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/ >