Re: [SQL] TG_TABLE_NAME as identifier

2008-02-07 Thread Tiziano Slack
Thanks, T. _ Organizza le tue feste e condividine le foto con Windows Live Eventi! http://home.services.spaces.live.com/events/

Re: [SQL] TG_TABLE_NAME as identifier

2008-02-06 Thread Richard Huxton
Tiziano Slack wrote: Thanks for the precious tips, but unfortunately the syntax: EXECUTE 'INSERT INTO '|| TG_TABLE_NAME ||' SELECT '|| NEW.*;is parsed correctly, but when the trigger is fired the following error is returned ERROR: column "*" not found in data type mytable CONTEXT: SQL stateme

Re: [SQL] TG_TABLE_NAME as identifier

2008-02-06 Thread Tiziano Slack
Thanks for the precious tips, but unfortunately the syntax: EXECUTE 'INSERT INTO '|| TG_TABLE_NAME ||' SELECT '|| NEW.*;is parsed correctly, but when the trigger is fired the following error is returned ERROR: column "*" not found in data type mytable CONTEXT: SQL statement "SELECT 'INSERT INT

Re: [SQL] TG_TABLE_NAME as identifier

2008-02-05 Thread Robins Tharakan
o Slack <[EMAIL PROTECTED]> Date: Feb 5, 2008 2:15 PM Subject: [SQL] TG_TABLE_NAME as identifier To: pgsql-sql@postgresql.org Hello everybody! I'm newbie to plpgsql syntax. Can anyone tell where I'm getting wrong? CREATE OR REPLACE FUNCTION tr_audit() RETURNS TRIGGER AS $tr_aud

Re: [SQL] TG_TABLE_NAME as identifier

2008-02-05 Thread Richard Huxton
Tiziano Slack wrote: Hello everybody! I'm newbie to plpgsql syntax. Can anyone tell where I'm getting wrong? INSERT INTO TG_TABLE_NAME SELECT NEW.*; If you need to build a dynamic query with plpgsql you'll need to assemble it as a string and use EXECUTE. You can use variables in comparison

[SQL] TG_TABLE_NAME as identifier

2008-02-05 Thread Tiziano Slack
Hello everybody! I'm newbie to plpgsql syntax. Can anyone tell where I'm getting wrong? CREATE OR REPLACE FUNCTION tr_audit() RETURNS TRIGGER AS $tr_audit$ BEGIN IF (TG_OP = 'UPDATE') THEN ... NEW.id = nextval(TG_TABLE_NAME || '_id_seq'::regclass); INSERT INTO