Re: Going beyond sql

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Jon <jonov(at)iprimus(dot)com(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Going beyond sql
Date: 2005-08-05 14:03:19
Message-ID: 20050805140319.GA97890@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Aug 03, 2005 at 06:50:48AM +1000, Jon wrote:
> I'd like to run some scripts against a postgres database but has more
> than just standard SQL commands. I'd like to be able to use conditional
> statements (i.e. if .. .then ... ) and such. I had a look and can see
> that I could use pgplsql for this. However it seems that it must be part
> of a function. Is there any way of doing this without the function
> coating as these commands would be a once off?

PostgreSQL's implementation of SQL doesn't have control structures
(aside from simple conditionals like CASE expressions), so you'll
have to write a server-side function in a language like PL/pgSQL
or do the control in client-side code.

--
Michael Fuhr

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laura Vance 2005-08-05 14:03:57 Re: Going beyond sql
Previous Message Tom Lane 2005-08-05 13:38:27 Re: How to explode an array into multiple rows