Re: edit function

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Rakotomandimby Mihamina <mihamina(at)gulfsat(dot)mg>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: edit function
Date: 2009-09-07 12:19:39
Message-ID: 52C94E89-5B4A-4C46-83B5-7FD9F92069B8@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Sep 7, 2009, at 2:26 AM, Rakotomandimby Mihamina wrote:

> I have a function like this:
>
> CREATE FUNCTION f_active_client(character varying)
> RETURNS character varying
> AS $_$
> DECLARE
> v_modem ALIAS FOR $1;
> v_firstuse BOOLEAN;
> v_admactive BOOLEAN;
> v_codeclt varchar;
> BEGIN
> SELECT INTO (...)
> IF FOUND THEN
> (...)
> ELSE
> RETURN 'ERROR';
> END IF;
> END;
> $_$
>
>
> I have to insert several IF statements in the "IF FOUND" one.
> I wont do it one time, I will insert them one by one.
>
> I cannot stop too much long the PG server (a /etc/init.d restart
> time is OK, more is not)
>
> Dumping and the restoring is not possible because of too long
> downtime.
>
> DELETing CREATing the function is not possible because of dependency.
>
> When looking at the help, '\h' has no REPLACE FUNCTION.
> Only ALTER FUNCTION
>
> How to manage it?

Write it exactly as you have above, but replace the first line with:

CREATE OR REPLACE FUNCTION f_active_client(character varying)

John DeSoi, Ph.D.

In response to

  • edit function at 2009-09-07 06:26:27 from Rakotomandimby Mihamina

Browse pgsql-general by date

  From Date Subject
Next Message Jerry LeVan 2009-09-07 13:03:28 Re: More Snow Leopard problems...
Previous Message Jasen Betts 2009-09-07 11:38:48 Re: [Q] optmizing postgres for 'single client' / many small queries