pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #13524: Not Getting expected Serialization error
3+ messages / 3 participants
[nested] [flat]
* BUG #13524: Not Getting expected Serialization error
@ 2015-07-28 20:45 bobby.rullo@coreos.com
2015-07-29 15:40 ` Re: BUG #13524: Not Getting expected Serialization error Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: bobby.rullo@coreos.com @ 2015-07-28 20:45 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 13524
Logged by: Robert Rullo
Email address: bobby.rullo@coreos.com
PostgreSQL version: 9.4.1
Operating system: Mac OS X
Description:
Because this requires concurrent transactions, we will consider two
different sequences of SQL statements, each to be executed in PSQL against
the same database.
Sequence 1:
=========
drop table if exists "t1";
create table if not exists "t1" ("id" text not null primary key, "name"
text, "email" text) ;
begin;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
select count(*) from "t1" where email = 'bill@example.com';
insert into "t1" ("id","name","email") values
('1','bill','bill@example.com');
-- EXECUTE sequence1.txt HERE
commit;
Sequence 2:
==========
begin;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
--select count(*) from "t1" where email = 'bill@example.com'; --UNCOMMENT
ME LATER
insert into "t1" ("id","name","email") values
('2','william','bill@example.com');
commit;
To reproduce:
1) execute statements in sequence 1 on a connection, stopping at the
"--EXECUTE" statement.
2) In another connection, execute all the statements in Sequence 2.
3) Back in the first connection execute the remaining statement (the
"commit;")
Expected:
error when trying to commit, eg. "ERROR: could not serialize"
Actual:
Both commits succeed.
Interesting tidbit:
If you do the exact steps as above but uncomment the "select count(*)" in
sequence 2, you get the expected error.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #13524: Not Getting expected Serialization error
2015-07-28 20:45 BUG #13524: Not Getting expected Serialization error bobby.rullo@coreos.com
@ 2015-07-29 15:40 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-07-29 16:50 ` Re: BUG #13524: Not Getting expected Serialization error Bobby Rullo <bobby.rullo@coreos.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2015-07-29 15:40 UTC (permalink / raw)
To: bobby.rullo@coreos.com; +Cc: pgsql-bugs
bobby.rullo@coreos.com writes:
> To reproduce:
> 1) execute statements in sequence 1 on a connection, stopping at the
> "--EXECUTE" statement.
> 2) In another connection, execute all the statements in Sequence 2.
> 3) Back in the first connection execute the remaining statement (the
> "commit;")
> Expected:
> error when trying to commit, eg. "ERROR: could not serialize"
> Actual:
> Both commits succeed.
> Interesting tidbit:
> If you do the exact steps as above but uncomment the "select count(*)" in
> sequence 2, you get the expected error.
This seems perfectly fine to me. Without the "select count(*)" in
transaction 2, there is a valid serialization of the transactions,
ie t1 before t2. Serializability is *not* defined as "the transactions
appear to have executed in the order they were started (or committed)".
It is defined as "there is some consistent order in which they appear
to have executed".
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #13524: Not Getting expected Serialization error
2015-07-28 20:45 BUG #13524: Not Getting expected Serialization error bobby.rullo@coreos.com
2015-07-29 15:40 ` Re: BUG #13524: Not Getting expected Serialization error Tom Lane <tgl@sss.pgh.pa.us>
@ 2015-07-29 16:50 ` Bobby Rullo <bobby.rullo@coreos.com>
0 siblings, 0 replies; 3+ messages in thread
From: Bobby Rullo @ 2015-07-29 16:50 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
That took me a while to wrap my head around but it makes sense now. Thanks
for the succinct explanation!
Bobby
On Wed, Jul 29, 2015 at 8:40 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> bobby.rullo@coreos.com writes:
> > To reproduce:
> > 1) execute statements in sequence 1 on a connection, stopping at the
> > "--EXECUTE" statement.
> > 2) In another connection, execute all the statements in Sequence 2.
> > 3) Back in the first connection execute the remaining statement (the
> > "commit;")
>
> > Expected:
> > error when trying to commit, eg. "ERROR: could not serialize"
>
> > Actual:
> > Both commits succeed.
>
> > Interesting tidbit:
> > If you do the exact steps as above but uncomment the "select count(*)" in
> > sequence 2, you get the expected error.
>
> This seems perfectly fine to me. Without the "select count(*)" in
> transaction 2, there is a valid serialization of the transactions,
> ie t1 before t2. Serializability is *not* defined as "the transactions
> appear to have executed in the order they were started (or committed)".
> It is defined as "there is some consistent order in which they appear
> to have executed".
>
> regards, tom lane
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2015-07-29 16:50 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28 20:45 BUG #13524: Not Getting expected Serialization error bobby.rullo@coreos.com
2015-07-29 15:40 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-07-29 16:50 ` Bobby Rullo <bobby.rullo@coreos.com>
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