Re: [SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-17 Thread Torsten Zühlsdorff
Jasen Betts schrieb: On 2010-05-11, Torsten Zühlsdorff f...@meisterderspiele.de wrote: Hello, i have a problem with a trigger written in pl/pgsql. It looks like this: CREATE OR REPLACE FUNCTION versionize() RETURNS TRIGGER AS $$ BEGIN NEW.revision := addContentRevision (OLD.content_id,

Re: [SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-13 Thread Jasen Betts
On 2010-05-11, Torsten Zühlsdorff f...@meisterderspiele.de wrote: Hello, i have a problem with a trigger written in pl/pgsql. It looks like this: CREATE OR REPLACE FUNCTION versionize() RETURNS TRIGGER AS $$ BEGIN NEW.revision := addContentRevision (OLD.content_id, OLD.revision);

[SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Torsten Zühlsdorff
Hello, i have a problem with a trigger written in pl/pgsql. It looks like this: CREATE OR REPLACE FUNCTION versionize() RETURNS TRIGGER AS $$ BEGIN NEW.revision := addContentRevision (OLD.content_id, OLD.revision); /* not working line, just a stub: EXECUTE 'INSERT INTO ' ||

[SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Torsten Zühlsdorff
Hello, i have a problem with a trigger written in pl/pgsql. It looks like this: CREATE OR REPLACE FUNCTION versionize() RETURNS TRIGGER AS $$ BEGIN NEW.revision := addContentRevision (OLD.content_id, OLD.revision); /* not working line, just a stub: EXECUTE 'INSERT INTO ' ||

Re: [SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Tom Lane
=?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= f...@meisterderspiele.de writes: NEW.revision := addContentRevision (OLD.content_id, OLD.revision); /* not working line, just a stub: EXECUTE 'INSERT INTO ' || TG_TABLE_NAME || ' SELECT $1 ' USING NEW; */ RETURN NULL; This seems like

Re: [SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Torsten Zühlsdorff
Tom Lane schrieb: =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= f...@meisterderspiele.de writes: NEW.revision := addContentRevision (OLD.content_id, OLD.revision); /* not working line, just a stub: EXECUTE 'INSERT INTO ' || TG_TABLE_NAME || ' SELECT $1 ' USING NEW; */ RETURN

[SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Torsten Zühlsdorff
Hello, i have a problem with a trigger written in pl/pgsql. It looks like this: CREATE OR REPLACE FUNCTION versionize() RETURNS TRIGGER AS $$ BEGIN NEW.revision := addContentRevision (OLD.content_id, OLD.revision); /* not working line, just a stub: EXECUTE 'INSERT INTO ' ||

Re: [SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Stuart
Torsten, Usually, the “insert ... (select ...)” has the select portion enclosed in parenthesis. Don't know if solution is that simple but did not see it in your examples. It may be worth a try. Stuart - Original message - Hello, i have a problem with a trigger written in