pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCan I read the data without commit
7+ messages / 4 participants
[nested] [flat]
* Can I read the data without commit
@ 2012-03-23 21:33 John Fabiani <johnf@jfcomputer.com>
0 siblings, 1 reply; 7+ messages in thread
From: John Fabiani @ 2012-03-23 21:33 UTC (permalink / raw)
To: pgsql-sql
Hi,
I know this is a newbie question but I have never had the need to do the
following.
I start a transaction.
Begin
Then I insert a lot of data - let's say two hundred rows.
Now I need to read the same data (so the user can review).
If the user thinks all is right then
commit.
Can I read the data I just inserted without committing?
Johnf
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Can I read the data without commit
@ 2012-03-23 21:40 Jonathan S. Katz <jonathan.katz@excoventures.com>
parent: John Fabiani <johnf@jfcomputer.com>
0 siblings, 1 reply; 7+ messages in thread
From: Jonathan S. Katz @ 2012-03-23 21:40 UTC (permalink / raw)
To: John Fabiani <johnf@jfcomputer.com>; +Cc: pgsql-sql
On Mar 23, 2012, at 5:33 PM, John Fabiani wrote:
> I start a transaction.
> Begin
>
> Then I insert a lot of data - let's say two hundred rows.
>
> Now I need to read the same data (so the user can review).
>
> If the user thinks all is right then
> commit.
>
> Can I read the data I just inserted without committing?
Yes, as long as you run your SELECT within the transaction that you started.
Jonathan
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Can I read the data without commit
@ 2012-03-23 21:46 Rob Sargent <robjsargent@gmail.com>
parent: Jonathan S. Katz <jonathan.katz@excoventures.com>
0 siblings, 1 reply; 7+ messages in thread
From: Rob Sargent @ 2012-03-23 21:46 UTC (permalink / raw)
To: pgsql-sql
If possible have the review done before starting the transaction. No
sense in holding on to that stuff too long. Potential concurrency issues
etc.
On 03/23/2012 03:40 PM, Jonathan S. Katz wrote:
> On Mar 23, 2012, at 5:33 PM, John Fabiani wrote:
>
>> I start a transaction.
>> Begin
>>
>> Then I insert a lot of data - let's say two hundred rows.
>>
>> Now I need to read the same data (so the user can review).
>>
>> If the user thinks all is right then
>> commit.
>>
>> Can I read the data I just inserted without committing?
>
> Yes, as long as you run your SELECT within the transaction that you started.
>
> Jonathan
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Can I read the data without commit
@ 2012-03-23 21:49 John Fabiani <johnf@jfcomputer.com>
parent: Rob Sargent <robjsargent@gmail.com>
0 siblings, 2 replies; 7+ messages in thread
From: John Fabiani @ 2012-03-23 21:49 UTC (permalink / raw)
To: pgsql-sql
Yes I understand - but I want to know is it possible? Can I read the data I
just inserted without a commit.
Johnf
On Friday, March 23, 2012 03:46:10 PM Rob Sargent wrote:
> If possible have the review done before starting the transaction. No
> sense in holding on to that stuff too long. Potential concurrency issues
> etc.
>
> On 03/23/2012 03:40 PM, Jonathan S. Katz wrote:
> > On Mar 23, 2012, at 5:33 PM, John Fabiani wrote:
> >> I start a transaction.
> >> Begin
> >>
> >> Then I insert a lot of data - let's say two hundred rows.
> >>
> >> Now I need to read the same data (so the user can review).
> >>
> >> If the user thinks all is right then
> >> commit.
> >>
> >> Can I read the data I just inserted without committing?
> >
> > Yes, as long as you run your SELECT within the transaction that you
> > started.
> >
> > Jonathan
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Can I read the data without commit
@ 2012-03-23 22:00 Rob Sargent <robjsargent@gmail.com>
parent: John Fabiani <johnf@jfcomputer.com>
1 sibling, 1 reply; 7+ messages in thread
From: Rob Sargent @ 2012-03-23 22:00 UTC (permalink / raw)
To: pgsql-sql
And I believe Jonathon confirmed that you could, with the caveat that
you must select from within the transaction. I don't see that you've
laid that out your connection stategy so ymmv.
On 03/23/2012 03:49 PM, John Fabiani wrote:
> Yes I understand - but I want to know is it possible? Can I read the data I
> just inserted without a commit.
> Johnf
> On Friday, March 23, 2012 03:46:10 PM Rob Sargent wrote:
>> If possible have the review done before starting the transaction. No
>> sense in holding on to that stuff too long. Potential concurrency issues
>> etc.
>>
>> On 03/23/2012 03:40 PM, Jonathan S. Katz wrote:
>>> On Mar 23, 2012, at 5:33 PM, John Fabiani wrote:
>>>> I start a transaction.
>>>> Begin
>>>>
>>>> Then I insert a lot of data - let's say two hundred rows.
>>>>
>>>> Now I need to read the same data (so the user can review).
>>>>
>>>> If the user thinks all is right then
>>>> commit.
>>>>
>>>> Can I read the data I just inserted without committing?
>>>
>>> Yes, as long as you run your SELECT within the transaction that you
>>> started.
>>>
>>> Jonathan
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Can I read the data without commit
@ 2012-03-23 22:11 John Fabiani <johnf@jfcomputer.com>
parent: Rob Sargent <robjsargent@gmail.com>
0 siblings, 0 replies; 7+ messages in thread
From: John Fabiani @ 2012-03-23 22:11 UTC (permalink / raw)
To: pgsql-sql
On Friday, March 23, 2012 04:00:56 PM Rob Sargent wrote:
> And I believe Jonathon confirmed that you could, with the caveat that
> you must select from within the transaction. I don't see that you've
> laid that out your connection stategy so ymmv.
I didn't see Jonathon response? Must be a direct email to me and not to the
list.
But thanks that helps.
Johnf
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Can I read the data without commit
@ 2012-03-23 22:25 Tim Landscheidt <tim@tim-landscheidt.de>
parent: John Fabiani <johnf@jfcomputer.com>
1 sibling, 0 replies; 7+ messages in thread
From: Tim Landscheidt @ 2012-03-23 22:25 UTC (permalink / raw)
To: pgsql-sql
John Fabiani <johnf@jfcomputer.com> wrote:
> Yes I understand - but I want to know is it possible? Can I read the data I
> just inserted without a commit.
> [...]
Are you talking about a web application? Then no, you'll
have to code that yourself.
Tim
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2012-03-23 22:25 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 21:33 Can I read the data without commit John Fabiani <johnf@jfcomputer.com>
2012-03-23 21:40 ` Jonathan S. Katz <jonathan.katz@excoventures.com>
2012-03-23 21:46 ` Rob Sargent <robjsargent@gmail.com>
2012-03-23 21:49 ` John Fabiani <johnf@jfcomputer.com>
2012-03-23 22:00 ` Rob Sargent <robjsargent@gmail.com>
2012-03-23 22:11 ` John Fabiani <johnf@jfcomputer.com>
2012-03-23 22:25 ` Tim Landscheidt <tim@tim-landscheidt.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox