Re: Stored procedure workflow question

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Israel Brewster <israel(at)ravnalaska(dot)net>, "pgsql-general(at)postgresql(dot)org general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Stored procedure workflow question
Date: 2014-12-11 01:04:33
Message-ID: 5488EDA1.3090101@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/10/2014 04:53 PM, Israel Brewster wrote:
> Currently, when I need to create/edit a stored procedure in Postgresql,
> my workflow goes like the following:
>
> - Create/edit the desired function in my "DB Commands" text file
> - Copy and paste function into my development database
> - Test
> - repeat above until it works as desired
> - Copy and paste function into my production DB.
>
> To edit an existing function, the workflow is basically the same as
> above, but I first have to find the function in my file.

For above use \ef in psql. See here for more details:

http://www.postgresql.org/docs/9.3/interactive/app-psql.html

You can save the file outside the database if needed.

>
> This whole workflow just feels kludgy to me. Is there a better way? Or
> is that essentially the recommended procedure? Thanks.

Keep the functions in separate files. Do either:

psql -d some_database -U some_user -f function_file.sql

or from within psql

\i some/path/to_file/function_file.sql

> -----------------------------------------------
> Israel Brewster
> Systems Analyst II
> Ravn Alaska
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7293
> -----------------------------------------------
>
>
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2014-12-11 01:16:08 Re: Stored procedure workflow question
Previous Message Gavin Flower 2014-12-11 01:03:35 Re: Stored procedure workflow question