From: | Александр <alexander_8901(at)mail(dot)ru> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | bug in RULE insert |
Date: | 2016-12-09 12:18:40 |
Message-ID: | 1481285920.491235434@f66.i.mail.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Strange the rule works for an insertion
example:
CREATE TABLE public.test
(
id bigserial NOT NULL,
name text
);
ALTER TABLE public.test
ADD CONSTRAINT test_constraint_pkey PRIMARY KEY(id);
CREATE TABLE public.v_test
(
id bigserial NOT NULL,
v_id bigint,
v_name text
);
ALTER TABLE public.v_test
ADD CONSTRAINT v_test_constraint_pkey PRIMARY KEY(id);
CREATE OR REPLACE RULE insert AS
ON INSERT TO test DO INSERT INTO v_test (v_id, v_name)
VALUES (new.id, new.name);
then execute
insert into test(name)
values
('1'),
('2'),
('3')
values in test.id <> v_test.v_id
Tested on postgresql 9.5/9.6 install from PPA http://apt.postgresql.org/pub/repos/apt
OS ubuntu-sever 14.04/16.04
Bbest regards
Alexander Pokolenko.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-12-09 15:25:37 | Re: bug in RULE insert |
Previous Message | Kaijiang Chen | 2016-12-09 04:27:02 | pg_dump's results have quite different size |