Re: partitioned table insert triggers

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Reece Hart <reece(at)harts(dot)net>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: partitioned table insert triggers
Date: 2008-06-23 01:18:36
Message-ID: 20080623100711.9454.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Reece Hart <reece(at)harts(dot)net> wrote:

> c := 'INSERT INTO ' || ctable || ' VALUES (NEW.*)';

> Now that my only idea is gone, the question for y'all is: how?
>
> ?(Okay, I actually do have one more idea: construct the insert values
> list with quote_literal. I'm hoping there's a better way.)

You need to do so in 8.3:
EXECUTE 'INSERT INTO ' || ctable ||
' VALUES( (' || quote_literal(new) || '::' || ptable || ').*)';

In 8.4, the next release, you will be able to use a better way:
EXECUTE 'INSERT INTO ' || ctable || ' VALUES( ($1).* )' USING new;

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Reece Hart 2008-06-23 02:42:20 Re: partitioned table insert triggers
Previous Message Patrick TJ McPhee 2008-06-22 18:24:22 Re: Importing undelimited files (Flat Files or Fixed-Length records)