Re: successive select statements

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: david(dot)sahagian(at)emc(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: successive select statements
Date: 2011-11-22 02:17:54
Message-ID: 29477.1321928274@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<david(dot)sahagian(at)emc(dot)com> writes:
> In postgresql.org/docs/9.1/static/transaction-iso.html I read
> 13.2.1. Read Committed Isolation Level
> . . . two successive SELECT commands can see different data, even though they are within a single transaction . . .

> Please consider this code being executed by postgres:
> = = = = = = = = = =
> select some_int from tableX
> union all
> select another_int from tableY
> ;
> = = = = = = = = = =
> Are these two select statements considered "successive" when isolation == Read Committed ?

No, the UNION is a single command. The fact that the word "SELECT"
occurs twice within it is a SQL syntactic artifact --- it doesn't
convert it into two commands.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2011-11-22 02:35:48 Re: how could duplicate pkey exist in psql?
Previous Message David Johnston 2011-11-22 02:16:07 Re: Select duplicated values