Insert into ... Select ... From ... too intelligent transaction

From: "Rose, Juergen" <Juergen(dot)Rose(at)sag-el(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Insert into ... Select ... From ... too intelligent transaction
Date: 2005-07-21 17:11:04
Message-ID: 1EDFE201921585419595B53913CAD6771B36C9@exchange.cegit.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I'm still working on my updateable views, which work fine now even I have a trigger to use because my delete rules wont work, but thats not my current, more important problem.

I use some updateable views to handle my data (which are amazingly slow), which gives me ultimate flexibility to handle my data.

there are some insert rules which use currval() to get the last sequence id for my data which I have to insert.

The problem now is, it works fine if I do the statement via normal insert into satatements, even within a transaction block. So far so good. But If I migrate my old data via **Insert into my_new_view Select ... From my_old_table**, Only the last retrieved value of the sequences is used which blows my whole internal logic, because obviously I want to use the current (for that row) and not the last id.

For me it seems that the optimizer optimizes a bit to much!

Is the an easy workaround?

Many thanks for any help
Jürgen

Responses

Browse pgsql-general by date

  From Date Subject
Next Message TJ O'Donnell 2005-07-21 17:40:21 dynamic loading of c-functions
Previous Message Janning Vygen 2005-07-21 16:24:01 Re: Query planner refuses to use index