default value dosen't get applyed in this situation

From: Aliouii Ali <aliouii(dot)ali(at)aol(dot)fr>
To: pgsql-hackers(at)postgresql(dot)org
Subject: default value dosen't get applyed in this situation
Date: 2015-05-10 21:10:05
Message-ID: 14d3fa9da17-686d-cee8@webprd-m96.mail.aol.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


this a test case :

CREATE TABLE tab
(
_id bigserial NOT NULL,
_name text,
CONSTRAINT tab_pkey PRIMARY KEY (_id)
);
CREATE TABLE tab_s1
(
CONSTRAINT tab_s1_check CHECK (1 = 1)
)
INHERITS (tab);
CREATE OR REPLACE VIEW v_tab AS
SELECT tab._id,
tab._name
FROM tab;
CREATE OR REPLACE FUNCTION tab_insert()

RETURNS trigger AS
$BODY$
BEGIN
INSERT INTO tab_s1 VALUES ((NEW).*);
RETURN NEW;
END $BODY$

LANGUAGE plpgsql;
CREATE TRIGGER tab_trigger
INSTEAD OF INSERT ON v_tab
FOR EACH ROW EXECUTE PROCEDURE tab_insert();

-- the query fail because _id is null
insert into v_tab(_name) values ('uuuu');

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-05-10 21:30:58 Re: Parallel Seq Scan
Previous Message Tom Lane 2015-05-10 20:01:53 Re: BUG #13148: Unexpected deferred EXCLUDE constraint violation on derived table