Bug #678: delete rules false report

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #678: delete rules false report
Date: 2002-05-26 20:48:08
Message-ID: 20020526204808.2A252475897@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Panayotis Cosmas (pkosmas(at)yahoo(dot)com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
delete rules false report

Long Description
I've just upgraded my database to postgre 7.2.1 from version 7.0.1.

I noticed that ON DELETE rules for views reports always DELETE 0 where it should report DELETE 1.

For example:
I type,
orders_db=# delete from view_orders_source where orders_id = 6533;
and postgre says,
orders_db=# DELETE 0
although the row has deleted succesfully.

When I try this on postgre 7.0.1 the reply is ok (DELETE 1).

Sample Code
CREATE TABLE "clients" (
"clients_id" int4 DEFAULT nextval('"clients_clients_id_seq"'::text) NOT NULL,
"clients_code" varchar(20) NOT NULL,
"clients_sales_group" varchar(30) NOT NULL,
"clients_name" varchar(50) NOT NULL,
"clients_address" varchar(100),
"clients_postal" varchar(7),
"clients_city" varchar(30),
"clients_main_tel" varchar(25),
"clients_other_tel" varchar(50),
"clients_fax" varchar(25),
"clients_email" varchar(50),
"clients_contact" varchar(50),
CONSTRAINT "clients_pkey" PRIMARY KEY ("clients_id")
) WITH OIDS;
GRANT ALL ON "clients" TO PUBLIC;

CREATE TABLE "orders" (
"orders_id" int4 DEFAULT nextval('"orders_orders_id_seq"'::text) NOT NULL,
"clients_id" int4 NOT NULL,
"orders_agency_name" varchar(50),
"orders_agency_address" varchar(50),
"orders_agency_city" varchar(20),
"orders_agency_tel" varchar(20),
"orders_input_date" date NOT NULL,
"orders_required_date" date,
"orders_shipment_client" varchar(50),
"orders_shipment_address" varchar(100),
"orders_shipment_city" varchar(30),
"orders_shipment_tel" varchar(25),
"orders_clients_orderid" varchar(15),
"orders_salesman" varchar(50) NOT NULL,
"orders_notes" varchar(200),
"orders_validated" bool DEFAULT '0' NOT NULL,
"orders_input_time" time,
CONSTRAINT "orders_pkey" PRIMARY KEY ("orders_id"),
CONSTRAINT "client_to_orders" FOREIGN KEY ("clients_id") REFERENCES "clients" ("clients_id") ON DELETE NO ACTION ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE
) WITH OIDS;
GRANT ALL ON "orders" TO PUBLIC;

CREATE VIEW "view_orders_source" AS SELECT
orders.clients_id,
clients.clients_code,
clients.clients_name,
clients.clients_address,
clients.clients_postal,
clients.clients_city,
clients.clients_main_tel,
clients.clients_fax,
clients.clients_contact,
clients.clients_sales_group,
orders.orders_id,
orders.orders_input_date,
orders.orders_input_time,
orders.orders_required_date,
orders.orders_shipment_client,
orders.orders_shipment_address,
orders.orders_shipment_city,
orders.orders_shipment_tel,
orders.orders_clients_orderid,
orders.orders_salesman, orders.
orders_notes, orders.orders_validated,
orders.orders_agency_name,
orders.orders_agency_address,
orders.orders_agency_city,
orders.orders_agency_tel
FROM (clients JOIN orders ON ((clients.clients_id = orders.clients_id)))
WHERE clients.clients_sales_group like '%'
AND
((SELECT db_user_location.db_user_place FROM db_user_location WHERE (db_user_location.db_user_name =

current_user)) = 'aigaleo')
and orders_id between (select max(orders_id)-20 from orders) and (select max(orders_id) from orders)
OR
clients.clients_sales_group = (SELECT db_user_location.db_user_place FROM db_user_location WHERE

(db_user_location.db_user_name = current_user))
and orders_id between (select max(orders_id)-20 from orders) and (select max(orders_id) from orders)
ORDER BY orders_id;

GRANT ALL ON "view_orders_source" TO PUBLIC;

create rule view_orders_source_rule_del as on delete to view_orders_source do instead
delete from orders where orders_id = OLD.orders_id;

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2002-05-27 02:56:22 Bug #679: Time input format is no longer ISO 8601 compliant
Previous Message pgsql-bugs 2002-05-26 18:47:45 Bug #677: Eliminating need for LD_LIBRARY_PATH during compile