Re: creating and accessing temp table data inside a non-committed transaction

From: Leon Starr <leon_starr(at)modelint(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: creating and accessing temp table data inside a non-committed transaction
Date: 2011-01-31 17:11:11
Message-ID: 361581B2-4CAE-47C6-A300-F60EE79C686E@modelint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Ah! That's what I had originally thought. So, if what you are saying is true,
then I just have a bug of some sort. I am NOT using any triggers. It's just a
simple function with deeper function calls nested about 5 levels down.

To slightly rephrase: Any database changes (inserts/updates) made by a transaction are visible
inside that transaction. So if I do an insert inside a transaction and then later, within the same
transaction, do a select on the inserted row, I should select the data that I inserted. Correct?

I will do my diagnostics with that in mind. Thanks!

- Leon

On Jan 31, 2011, at 7:42 AM, Kevin Grittner wrote:

> Leon Starr <leon_starr(at)modelint(dot)com> wrote:
>
>> The problem is that the values x, y and z are inserted into a
>> permanent table Q early in the processing of my_func. Then,
>> several calls down in deep_func(), still inside my_func, I need to
>> access the value of x. I tried to do a select on Q to get the
>> value, but I came up NULL! Guessing that is because the
>> transaction hasn't committed yet since I am still inside my_func.
>> Right?
>
> I don't think so. Any database changes made by a transaction should
> be visible to that transaction. When you say "several calls down in
> deep_func()", you don't mean that you are in a BEFORE trigger
> function, or a function called from a BEFORE trigger, do you?
>
> Perhaps you could boil the issue down to a small self-contained
> example of the issue?
>
> -Kevin

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Leon Starr 2011-01-31 17:13:41 Re: creating and accessing temp table data inside a non-committed transaction
Previous Message Kevin Grittner 2011-01-31 15:42:04 Re: creating and accessing temp table data inside a non-committed transaction