Views and Rules again

From: DaVinci <bombadil(at)wanadoo(dot)es>
To: Lista PostgreSql <pgsql-general(at)postgresql(dot)org>
Subject: Views and Rules again
Date: 2001-05-03 07:53:34
Message-ID: 20010503095334.A8706@fangorn.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Diana Cionoiu 2001-05-03 08:00:56 Re: troubles with postgresql 7.0.2
Previous Message Alexander Lohse 2001-05-03 07:51:23 stored procedures