Re: Can you make a simple view non-updatable?

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Can you make a simple view non-updatable?
Date: 2018-06-08 09:27:02
Message-ID: 9f42a43a-cb8d-a82c-05c5-fb0e30ec1a91@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/08/2018 04:17 AM, Ryan Murphy wrote:
>
> maybe it is time to overhaul the security concept.
>
>
> I could see how I could revoke permissions from, say, all users that
> aren't superusers to INSERT or UPDATE certain views.  However, if possible
> it would be nice to get an error message about the VIEW not being
> updatable, rather than a user access error, which could be misleading.
>
> When I try to insert into a non-updatable VIEWs, I get this message:
>
> ERROR:  cannot insert into view "test_view"
> DETAIL:  Views containing GROUP BY are not automatically updatable.
> HINT:  To enable inserting into the view, provide an INSTEAD OF INSERT
> trigger or an unconditional ON INSERT DO INSTEAD rule.
>
> It would be great to see something like this when trying to insert into a
> simple VIEW that I had made non-updatable:
>
> ERROR:  cannot insert into view "test_view2"
> DETAIL:  This view has manually been made non-updatable.

Something like CREATE READ ONLY VIEW test_view2 AS SELECT ....

--
Angular momentum makes the world go 'round.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jean Claude 2018-06-08 09:40:28 Re: Service pgpool
Previous Message Justin Clift 2018-06-08 09:18:36 Re: Code of Conduct plan