Обсуждение: This script will crash the connection
Helo all,
Please try this script, it will crash the current connection.
I'm using the 01/18/2001 PostgreSQL v7.1 beta3 snapshot.
-- Script begin -------------------------------------
create table blah(
var_field varchar(8),
n1 integer default 23,
n2 integer,
arr_str varchar[],
m money,
s text
);
create rule blah_update as
on update to blah
do
notify TestEvent;
INSERT INTO blah (var_field, n1, n2, arr_str, m, s) VALUES ('aaa', 1, 2,
NULL, NULL, NULL);
UPDATE blah SET n1=n1+1; -- Won't crash the connection
UPDATE blah SET n1=2 WHERE var_field='aaa' AND n1=1 AND n2=2 AND arr_str IS
NULL AND m IS NULL; -- Will crash the connection
-- Script end -------------------------------------
psql will print :
pqReadData() -- backend closed the channel unexpectedly.
This probably means the backend terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!#
Any comments ?
I need this kind of code working for a demo for ZeosDBO users...
--
Best Regards,
Steve Howe
----- Original Message -----
From: "Steve Howe" <howe@carcass.dhs.org>
> Helo all,
>
> Please try this script, it will crash the current connection.
> I'm using the 01/18/2001 PostgreSQL v7.1 beta3 snapshot.
> UPDATE blah SET n1=2 WHERE var_field='aaa' AND n1=1 AND n2=2 AND arr_str
IS
> NULL AND m IS NULL; -- Will crash the connection
Confirmed - only when the update has a "where" clause - a rule on insert or
an update without where seems to work.
Doesn't seem to be the notify - backend crashes with
create rule blah_upd as on update to blah do insert into foo (dummy) values
('test');
version:
========
PostgreSQL 7.1beta3 on i586-pc-linux-gnu, compiled by GCC egcs-2.91.66
- Richard Huxton
"Richard Huxton" <dev@archonet.com> writes:
> Doesn't seem to be the notify - backend crashes with
> create rule blah_upd as on update to blah do insert into foo (dummy) values
> ('test');
Actually, that was a completely different bug :-(. Thanks for the
report.
regards, tom lane