Re: Allowing COPY into views

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Allowing COPY into views
Date: 2007-04-19 14:39:18
Message-ID: 20070419143918.GB8402@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Karl O. Pinc wrote:
>
> On 04/19/2007 08:41:55 AM, Karl O. Pinc wrote:
>
> >I would like to submit a patch so that the
> >COPY statement can import data into a view.
>
> >2) Allocate memory for char* and construct an
> >'INSERT ...' statement corresponding
> >to the COPY command that inserts into the view.
> >(Just how much memory should be allocated?
> >Is there a standard buffer pre-alocated somewhere or a
> >standard buffer size?)
>
> I'll use a StringInfo.
>
> And I forgot, the final step is to add regression
> tests. One for view with an INSERT rule and one
> to catch the error for a view without an INSERT rule.

I'm not sure the plan is OK as stated. You wouldn't want to force to
parse the query again for each row. Rather, create a prepared statement
(already parsed, because you obtain it from the parsetree stored in the
INSERT rule) to pass to the executor.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-04-19 14:45:48 Re: Allowing COPY into views
Previous Message Andrew Dunstan 2007-04-19 14:33:44 Re: Allowing COPY into views