BUG #15623: Inconsistent use of default for updatable view

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: rocurley(at)gmail(dot)com
Subject: BUG #15623: Inconsistent use of default for updatable view
Date: 2019-02-07 21:42:30
Message-ID: 15623-5d67a46788ec8b7f@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

The following bug has been logged on the website:

Bug reference: 15623
Logged by: Roger Curley
Email address: rocurley(at)gmail(dot)com
PostgreSQL version: 11.1
Operating system: Ubuntu 11.1
Description:

Steps to reproduce (run in psql shell):
```
DROP TABLE IF EXISTS test CASCADE;
CREATE TABLE test (
id int PRIMARY KEY,
value int DEFAULT 0
);
CREATE VIEW test_view AS (SELECT * FROM test);

INSERT INTO test_view VALUES (1, DEFAULT), (2, DEFAULT);
INSERT INTO test VALUES (3, DEFAULT), (4, DEFAULT);
INSERT INTO test_view VALUES (5, DEFAULT);
SELECT * FROM test;
```

Result:
```
id | value
----+-------
1 |
2 |
3 | 0
4 | 0
5 | 0
```

Expected Result:
```
id | value
----+-------
1 | 0
2 | 0
3 | 0
4 | 0
5 | 0
```
In particular, it's surprising that inserting 1 row into an updatable view
uses the table default, while inserting 2 uses null.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Langote 2019-02-08 05:07:28 Re: BUG #15623: Inconsistent use of default for updatable view
Previous Message Tom Lane 2019-02-07 14:40:28 Re: BUG #15613: Bug in PG Planner for Foreign Data Wrappers

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-02-07 21:58:06 Re: phase out ossp-uuid?
Previous Message Gavin Flower 2019-02-07 21:33:57 Re: Commit Fest 2019-01 is now closed