BUG #18546: Attempt to insert default into a non-updatable column of a view fails with a dubious error

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #18546: Attempt to insert default into a non-updatable column of a view fails with a dubious error
Date: 2024-07-20 09:00:01
Message-ID: 18546-84a292e759a9361d@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18546
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 17beta2
Operating system: Ubuntu 22.04
Description:

The following query:
CREATE TABLE t (a int);
CREATE VIEW v AS SELECT a, a + 0 AS a0 FROM t;
INSERT INTO v values (default, default);
raises
ERROR: XX000: attribute number 2 not found in view targetlist
LOCATION: adjust_view_column_set, rewriteHandler.c:3045

Whilst
INSERT INTO v values (default, 1);
fails with clearer
ERROR: 0A000: cannot insert into column "a0" of view "v"
DETAIL: View columns that are not columns of their base relation are not
updatable.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-07-20 16:26:29 Re: BUG #18546: Attempt to insert default into a non-updatable column of a view fails with a dubious error
Previous Message Tom Lane 2024-07-19 19:03:57 Re: BUG #18545: \dt breaks transaction, calling error when executed in SET SESSION AUTHORIZATION