pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: rocurley@gmail.com
Subject: BUG #15623: Inconsistent use of default for updatable view
Date: Thu, 07 Feb 2019 21:42:30 +0000
Message-ID: <15623-5d67a46788ec8b7f@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15623
Logged by:          Roger Curley
Email address:      rocurley@gmail.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.



view thread (13+ messages)  latest in thread

Message-ID: <15623-5d67a46788ec8b7f@postgresql.org>
Permalink:  ../15623-5d67a46788ec8b7f@postgresql.org/
Also on:    postgresql.org/message-id/15623-5d67a46788ec8b7f@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, rocurley@gmail.com
  Subject: Re: BUG #15623: Inconsistent use of default for updatable view
  In-Reply-To: <15623-5d67a46788ec8b7f@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox