dynamic insert in plpgsql

From: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: dynamic insert in plpgsql
Date: 2010-01-08 14:55:53
Message-ID: 2f4958ff1001080655k4c417286kfb9eb0e75f50240d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is there any nice way to do something like that in plpgsql:

EXECUTE 'INSERT INTO '||partition_table_name||' VALUES'||(NEW.*)||'';

It would probably work, but some values are NULL, and plpgsql
interpreter just puts empty space there. So I get ('1',2,3,,,); Which
obviously is confusing INSERT.

thx.

--
GJ

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2010-01-08 14:58:58 Re: dynamic insert in plpgsql
Previous Message Tom Lane 2010-01-08 14:46:53 Re: pg.dropped