pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Wells Oliver <wells.oliver@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: UPDATE works on a view?
Date: Wed, 05 Aug 2020 14:42:42 -0400
Message-ID: <2551366.1596652962@sss.pgh.pa.us> (raw)
In-Reply-To: <CAOC+FBUYTaQ+Sk2tA24NdExek4_-S5q4Oe86Bx4K_6Th5F-aWQ@mail.gmail.com>
References: <CAOC+FBUYTaQ+Sk2tA24NdExek4_-S5q4Oe86Bx4K_6Th5F-aWQ@mail.gmail.com>

Wells Oliver <wells.oliver@gmail.com> writes:
> Err, sorry if this is back to basics, but I was very confused by someone
> being able to *UPDATE myview SET col = 1* and the underlying table actually
> being updated properly.
> Is this recent? When did we become able to UPDATE on views?

Depends on your definition of "recent" ...


Author: Tom Lane <tgl@sss.pgh.pa.us>
Branch: master Release: REL9_3_BR [a99c42f29] 2012-12-08 18:26:21 -0500

    Support automatically-updatable views.
    
    This patch makes "simple" views automatically updatable, without the need
    to create either INSTEAD OF triggers or INSTEAD rules.  "Simple" views
    are those classified as updatable according to SQL-92 rules.  The rewriter
    transforms INSERT/UPDATE/DELETE commands on such views directly into an
    equivalent command on the underlying table, which will generally have
    noticeably better performance than is possible with either triggers or
    user-written rules.  A view that has INSTEAD OF triggers or INSTEAD rules
    continues to operate the same as before.
    
    For the moment, security_barrier views are not considered simple.
    Also, we do not support WITH CHECK OPTION.  These features may be
    added in future.
    
    Dean Rasheed, reviewed by Amit Kapila


			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <2551366.1596652962@sss.pgh.pa.us>
Permalink:  ../2551366.1596652962@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2551366.1596652962@sss.pgh.pa.us

 · 

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-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, wells.oliver@gmail.com
  Subject: Re: UPDATE works on a view?
  In-Reply-To: <2551366.1596652962@sss.pgh.pa.us>

* 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