Views and Rules again

Поиск
Список
Период
Сортировка
От DaVinci
Тема Views and Rules again
Дата
Msg-id 20010503095334.A8706@fangorn.net
обсуждение исходный текст
Список pgsql-general
 Hi.

 I have this rule for inserting in a view:

--------------------------------------
te rule v_address_ins as on insert to v_address do instead
    (insert into address(calle,vía,localidad,provincia) values (
        NEW.calle,
        get_vía(NEW.vía),
        get_localidad(NEW.localidad),
        get_provincia(NEW.provincia));
    select currval('address_cod_seq'););
--------------------------------------

 I don't know if this is a good form. When I do an insert into v_address,
 get automagically cod of tuple inserted in same operation.

 Problem is that it doesn't work inside a plpgsql function. I get error:

     ERROR:  unexpected SELECT query in exec_stmt_execsql()

 When trying selecting result of insert, I get parser error. Is there any
 form of doing this?.

 Thanks.

                             David

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Improve a query...
Следующее
От: Alexander Lohse
Дата:
Сообщение: stored procedures