Re: TG_TABLE_NAME as identifier - Mailing list pgsql-sql

From Tiziano Slack
Subject Re: TG_TABLE_NAME as identifier
Date
Msg-id BAY109-W22937ED37F3081CAEC9F26CE2E0@phx.gbl
Whole thread Raw
In response to TG_TABLE_NAME as identifier  (Tiziano Slack <slack83@hotmail.it>)
Responses Re: TG_TABLE_NAME as identifier
List pgsql-sql
<div style="text-align: left;"><div style="text-align: left;">Thanks for the precious tips, but unfortunately the
syntax:<br/><pre class="EC_data1"><span class="EC_keyword">EXECUTE</span> <span class="EC_literal">'INSERT INTO
'</span>||TG_TABLE_NAME ||<span class="EC_literal">' SELECT </span><span class="EC_keyword">'||
NEW</span>.*;</pre></div>isparsed correctly, but when the trigger is fired the following error is returned<br /><br
/>ERROR: column "*" not found in data type mytable<br />CONTEXT:  SQL statement "SELECT  'INSERT INTO '||  $1  ||'
SELECT'||  $2 .*"<br /><br />Using <br /><pre class="EC_data1"><span class="EC_keyword">EXECUTE</span> <span
class="EC_literal">'INSERTINTO '</span>|| TG_TABLE_NAME ||<span class="EC_literal">' SELECT NEW.*'</span>;<br
/></pre>instead,returns:<br /><br />ERROR:  NEW used in query that is not in a rule<br />CONTEXT:  SQL statement
"INSERTINTO anag_referenti SELECT NEW.*"<br /><br />Hope someone can show me another way to do that, if exists ;)<br
/><br/>Have a nice day!<br /><br />T.</div><br /><hr />Raccolta foto di Windows Live <a
href="http://get.live.com/photogallery/overview"target="_new">Ordina e condividi le tue foto in maniera semplice e
veloce!</a>

pgsql-sql by date:

Previous
From: Steve Midgley
Date:
Subject: Re: accounting schema
Next
From: Richard Huxton
Date:
Subject: Re: TG_TABLE_NAME as identifier