Обсуждение: Possible bug in 7.4.5

Поиск
Список
Период
Сортировка

Possible bug in 7.4.5

От
Devrim GUNDUZ
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

I'm using 7.4.5 on a test platform and had a weird behaviour. Here is the
case:

test=# CREATE TABLE t1 (s_no int2 PRIMARY KEY,a varchar(10));
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey"
for table "t1"
test=# CREATE TABLE t2 (s_no int2, x char(2), CONSTRAINT
s_no_exists FOREIGN KEY(s_no) REFERENCES t1 ON UPDATE CASCADE);
test=# INSERT INTO t1 VALUES ('20','test1');
test=# INSERT INTO t1 VALUES ('21','test2');
test=# BEGIN ;
test=# INSERT INTO t2  VALUES ('20','as');
test=# COMM;
ERROR:  syntax error at or near "COMM" at character 1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test=# COMMIT ;
COMMIT
^^^^^^^^^^^^^^^

Shouldn't it  say "ERROR:  current transaction is aborted, commands
ignored until end of transaction block" after the commit?

Since COMMIT was executed 'successfully', I thought that t2 has a row
inside, but:

test=# SELECT * from t2 ;
  s_no | x
- ----------+---
(0 rows)

Am I missing something, or is it a bug? I can't reproduce it in 8.0beta2.

Regards,
- --
Devrim GUNDUZ
devrim~gunduz.org                devrim.gunduz~linux.org.tr
             http://www.tdmsoft.com
             http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBY7aKtl86P3SPfQ4RAqUjAKDozbghdFKr0nHoO6uHZSoYQcl9FwCdEbtP
uhbCpVAqfhzijJG+g/XDO1Q=
=ROu9
-----END PGP SIGNATURE-----

Re: Possible bug in 7.4.5

От
Kris Jurka
Дата:
On Wed, 6 Oct 2004, Devrim GUNDUZ wrote:

> [I say COMMIT on a failed transaction and it looks successful, but isn't.]

This is a long standing behavior.  Internally a ROLLBACK happens, but
commit is reported back to the client.  This has only changed in 8.0 to
reflect what actually happened.

Kris Jurka

Re: Possible bug in 7.4.5

От
Tom Lane
Дата:
Devrim GUNDUZ <devrim@gunduz.org> writes:
> Am I missing something, or is it a bug? I can't reproduce it in 8.0beta2.

8.0 actually behaves the same way: the COMMIT gets you out of the
transaction block.  It just tells you that it's treating it as a
rollback:

regression=# comm;
ERROR:  syntax error at or near "comm" at character 1
LINE 1: comm;
        ^
regression=# commit;
ROLLBACK
regression=#

whereas prior versions did the rollback but still reported the command
tag as COMMIT.  AFAIR, Postgres has always acted that way.

            regards, tom lane

Re: Possible bug in 7.4.5

От
Devrim GUNDUZ
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

On Wed, 6 Oct 2004, Tom Lane wrote:

> Devrim GUNDUZ <devrim@gunduz.org> writes:
>> Am I missing something, or is it a bug? I can't reproduce it in 8.0beta2.

<snip>
> whereas prior versions did the rollback but still reported the command
> tag as COMMIT.  AFAIR, Postgres has always acted that way.

Ok got it, thanks.

Do we still need a backported fix? Software developers (PHP developers,
for example) may get confused from the error message they get.

Regards,
- --
Devrim GUNDUZ
devrim~gunduz.org                devrim.gunduz~linux.org.tr
             http://www.tdmsoft.com
             http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBZANGtl86P3SPfQ4RAtfnAJ0R64Y7/2yZqINTlNdgSI1mExg6vACg0XTb
cSA9IIv5Dng8k+ot3ylIQEw=
=/ykx
-----END PGP SIGNATURE-----

Re: Possible bug in 7.4.5

От
Tom Lane
Дата:
Devrim GUNDUZ <devrim@gunduz.org> writes:
> Do we still need a backported fix?

No.  This is a behavioral change of a *very* longstanding behavior.
It's going in at 8.0, not 7.4.something.

            regards, tom lane