default value dosen't get applyed in this situation - Mailing list pgsql-hackers

From Aliouii Ali
Subject default value dosen't get applyed in this situation
Date
Msg-id 14d3fa9da17-686d-cee8@webprd-m96.mail.aol.com
Whole thread Raw
Responses Re: default value dosen't get applyed in this situation
List 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');

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #13148: Unexpected deferred EXCLUDE constraint violation on derived table
Next
From: Robert Haas
Date:
Subject: Re: Parallel Seq Scan