Re: Implementing replace function

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема Re: Implementing replace function
Дата
Msg-id AANLkTinKzYnPUqW4ZeS1e35uopcD3wSMhrwrNrRUdp33@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Implementing replace function  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Implementing replace function  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-general
Thanks Pavel, but I have an SQL procedure and not plpgsql?

On Sun, Oct 31, 2010 at 9:34 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>> But how can I detect that the UPDATE has failed in my SQL procedure?
>>
>
> see: http://www.postgresql.org/docs/8.4/interactive/plpgsql-control-structures.html
> near to end of page

>>        create or replace function update_pref_users(id varchar,
>>            first_name varchar, last_name varchar, female boolean,
>>            avatar varchar, city varchar, last_ip inet) returns void as $$
>>
>>                update pref_users set
>>                    first_name = $2,
>>                    last_name = $3,
>>                    female = $4,
>>                    avatar = $5,
>>                    city = $6,
>>                    last_ip = $7
>>                where id = $1;
>>
>>                -- XXX how to detect failure here? XXX
>>
>>                insert into pref_users(id, first_name, last_name,
>>                    female, avatar, city, last_ip)
>>                    values ($1, $2, $3, $4, $5, $6, $7);
>>        $$ language sql;

В списке pgsql-general по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: max_fsm_pages increase
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Implementing replace function