Updatable Views and INSERT INTO ... ON CONFLICT

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Updatable Views and INSERT INTO ... ON CONFLICT
Date: 2022-01-01 12:52:43
Message-ID: ddd29182-86fb-4c2b-a930-85dcfe2272d0@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I note it's not yet possible to INSERT INTO an Updatable View using the ON CONFLICT feature.

One imaginable pattern is when a user wants to refactor by renaming a table,
but for some reason cannot refactor some specific application and want to
allow it to continue to use the table's old name.

One approach to do so would be to create a an Updatable View (aka Simple view) [1],
given the same name as the table's old name.

This is ugly and not something I would do myself, but I've read about how others describe this pattern, not in the context of ON CONFLICT, but in general, when refactoring.

Are there reasons why it would not be possible to develop support INSERT INTO ... ON CONFLICT for Updatable Views?

Not saying it is desired, just trying to better understand the limits of Updatable Views.

/Joel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhihong Yu 2022-01-01 15:33:10 Re: Collecting statistics about contents of JSONB columns
Previous Message Joel Jacobson 2022-01-01 09:53:44 Re: Foreign key joins revisited