On Tue, 9 Jun 2009, G. Allegri wrote:
> Hello list.
> I'm a newbie with plpgsql, so I'm sorry for doing stupid questions...
> I have a situation whit one table where items are related to two other
> tables through a common id (unique in the first table) and the table
> name. Whenever the user exec
Stephan, you're rigth. It was just a first try. In the real situation
"seconda" and "terza" have a prima_id column. So the right one is:
execute 'UPDATE '|| NEW.tabella ||' SET nome='||
quote_literal(NEW.nome) ||' WEHERE prima_id=' || NEW.id || ';';
I though that double apices would quote. That w
Great, quote_literal() solved it! It was so easy :)
Thx Richard
2009/6/9 Richard Huxton :
> G. Allegri wrote:
>>
>> ERROR: Column 'lets_try' does not exist
>> LINE 1: INSERT INTO seconda (nome) VALUES ('lets_try')
>>
>> My function and trigger are:
>>
>> CREATE OR REPLACE FUNCTION fun1() RETURNS
G. Allegri wrote:
ERROR: Column 'lets_try' does not exist
LINE 1: INSERT INTO seconda (nome) VALUES ('lets_try')
My function and trigger are:
CREATE OR REPLACE FUNCTION fun1() RETURNS TRIGGER AS
$primaprova$
DECLARE
nome varchar;
BEGIN
IF (TG_OP='INSERT') THEN
execute 'INSERT INTO ' || NEW.tab
Hello list.
I'm a newbie with plpgsql, so I'm sorry for doing stupid questions...
I have a situation whit one table where items are related to two other
tables through a common id (unique in the first table) and the table
name. Whenever the user execute an operation on an item of the first
one ("pr