pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Tiziano Slack <slack83@hotmail.it>
Cc: pgsql-sql@postgresql.org
Subject: Re: TG_TABLE_NAME as identifier
Date: Tue, 05 Feb 2008 09:32:50 +0000
Message-ID: <47A82D42.8070007@archonet.com> (raw)
In-Reply-To: <BAY109-W28A8D4A3264086A0C38DA5CE2C0@phx.gbl>
References: <BAY109-W28A8D4A3264086A0C38DA5CE2C0@phx.gbl>

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 
comparisons etc. but not as column-names or table-names.

You might want to look at pltcl or plperl etc. if you are going to be 
doing a lot of this sort of stuff.

-- 
   Richard Huxton
   Archonet Ltd



view thread (6+ messages)  latest in thread

Message-ID: <47A82D42.8070007@archonet.com>
Permalink:  ../47A82D42.8070007@archonet.com/
Also on:    postgresql.org/message-id/47A82D42.8070007@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, slack83@hotmail.it
  Subject: Re: TG_TABLE_NAME as identifier
  In-Reply-To: <47A82D42.8070007@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox