Re: TG_TABLE_NAME as identifier
От | Richard Huxton |
---|---|
Тема | Re: TG_TABLE_NAME as identifier |
Дата | |
Msg-id | 47AAB8B6.70807@archonet.com обсуждение исходный текст |
Ответ на | Re: TG_TABLE_NAME as identifier (Tiziano Slack <slack83@hotmail.it>) |
Список | pgsql-sql |
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 followingerror is returned > > ERROR: column "*" not found in data type mytable > CONTEXT: SQL statement "SELECT 'INSERT INTO '|| $1 ||' SELECT '|| $2 .*" > > Using > EXECUTE 'INSERT INTO '|| TG_TABLE_NAME ||' SELECT NEW.*'; > instead, returns: > > ERROR: NEW used in query that is not in a rule > CONTEXT: SQL statement "INSERT INTO anag_referenti SELECT NEW.*" > > Hope someone can show me another way to do that, if exists ;) You'll have to build the INSERT in full - column by column. Have you considered plperl / pltcl etc. - that makes it easier to do. -- Richard Huxton Archonet Ltd
В списке pgsql-sql по дате отправления: