Thread: Importing data into views fails

Importing data into views fails

From
"Karl O. Pinc"
Date:
Hi,

I've created an INSERT rule on a view
but when I try to use the COPY command to
import data into the view it fails with.

   cannot copy to view "viewname"

I can create a temporary table and COPY
into the temporary table and then
INSERT into the view by selecting
from the temporary table.  But that's
sorta lame, especially because I don't
want the front-end to care whether it's
importing into a table or a view.

Does anyone have any suggestions?

Is there some reason why COPYing into
views is disallowed or is there just an
extra error check in the code that's getting
in my way?  If so, would the project be
open to accepting a patch?

Thanks for the work.

Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."
                  -- Robert A. Heinlein


Re: Importing data into views fails

From
Tom Lane
Date:
"Karl O. Pinc" <kop@meme.com> writes:
> Is there some reason why COPYing into
> views is disallowed or is there just an
> extra error check in the code that's getting
> in my way?  If so, would the project be
> open to accepting a patch?

COPY doesn't fire rules.

Feel free to send a patch, but don't expect it to be a one-liner.

            regards, tom lane

Re: Importing data into views fails

From
Walter Vaughan
Date:
Karl O. Pinc wrote:

> I've created an INSERT rule on a view
> but when I try to use the COPY command to
> import data into the view it fails with.
>
>   cannot copy to view "viewname"

If the day was 24hours earlier, and Mr. Pinc was asking about some problem with
his "frail loop" view update, I would think it's some sort of 4/1 issue.

I was kinda bummed out we're all so serious here.

--
Walter