Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fsujE-0003Gc-V3 for pgsql-general@arkaria.postgresql.org; Thu, 23 Aug 2018 18:53:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fsujD-0001og-4c for pgsql-general@arkaria.postgresql.org; Thu, 23 Aug 2018 18:53:07 +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.89) (envelope-from ) id 1fsujC-0001oY-Ph for pgsql-general@lists.postgresql.org; Thu, 23 Aug 2018 18:53:06 +0000 Received: from aragorn.net-wizard.org ([138.201.127.29] helo=gandalf.net-wizard.org) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fsuj5-0007cc-Ez for pgsql-general@postgresql.org; Thu, 23 Aug 2018 18:53:05 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.net-wizard.org (Postfix) with ESMTP id E475380DB7; Thu, 23 Aug 2018 20:52:55 +0200 (CEST) X-Virus-Scanned: Gentoo amavisd-new at aragorn Received: from aragorn.net-wizard.org ([127.0.0.1]) by localhost (aragorn.net-wizard.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oEipoK7dOBRM; Thu, 23 Aug 2018 20:52:53 +0200 (CEST) Received: from MTEC0211 (mtec-lee-dock-2-133.ethz.ch [129.132.6.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: clavadetscher@swisspug.org) by gandalf.net-wizard.org (Postfix) with ESMTPSA id 3494D80DB3; Thu, 23 Aug 2018 20:52:49 +0200 (CEST) From: "Charles Clavadetscher" To: "'Paul Tilles'" , References: In-Reply-To: Subject: RE: extracting the sql for a function Date: Thu, 23 Aug 2018 20:52:42 +0200 Message-ID: <03a101d43b12$7f1f12e0$7d5d38a0$@swisspug.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQG/tp9oQrhl7fKzC0YIv+G9wIfVs6T2tv4A Content-Language: de-ch List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello > -----Original Message----- > From: Paul Tilles [mailto:paul.tilles@noaa.gov] > Sent: Donnerstag, 23. August 2018 19:18 > To: pgsql-general@postgresql.org > Subject: extracting the sql for a function > > Using postgres Version 9.5 > > I can extract the sql for a table using > > pg_dump -d database_name -s -t table_name -f table_name.sql > > Is there something equivalent for extracting the sql for a function from the database? > > > Paul Tilles > I don't know if there is but you can get the function definition: SELECT * FROM pg_get_functiondef('functionname'::regproc); or SELECT * FROM pg_get_functiondef('functionname(list of parameters data types)'::regprocedure); If you want to export you may use the -t and -o switches. Regards Charles