Re: Proof of concept: auto updatable views [Review of Patch]

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Amit kapila <amit(dot)kapila(at)huawei(dot)com>, "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com>, "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proof of concept: auto updatable views [Review of Patch]
Date: 2012-10-12 05:39:49
Message-ID: CAEZATCW=YExNrEfvJFT7BFQz1FOsh26zDXTK+armLA+VjU_c7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for looking at this.
Attached is a rebased patch using new OIDs.

On 11 October 2012 02:39, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> Compiler warning needs to be fixed:
>
> rewriteHandler.c: In function 'RewriteQuery':
> rewriteHandler.c:2153:29: error: 'view_rte' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> rewriteHandler.c:2015:17: note: 'view_rte' was declared here
>

Ah, my version of gcc doesn't give that warning. Looking at the code
afresh though, I think that code block is pretty ugly. The attached
version rewrites that block in a more compact form, which I think is
also much more readable, and should cure the compiler warning.

> Maybe we should distinguish updatable from insertable in error messages
> like this one:
>
> ERROR: cannot insert into view "foov2"
> DETAIL: Views containing DISTINCT are not updatable.
>
> The SQL standard distinguishes the two, so there could be differences.
> I'm not sure what they are right now, though.
>
> This hint could use some refreshing:
>
> HINT: You need an unconditional ON INSERT DO INSTEAD rule or an INSTEAD OF INSERT trigger.
>
> Maybe something along the lines of
>
> HINT: To make the view insertable anyway, supply an unconditional ... etc.
>

I've not updated the error messages - I need to think about that a bit more.

Regards,
Dean

Attachment Content-Type Size
auto-update-views.patch.gz application/x-gzip 16.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Abhijit Menon-Sen 2012-10-12 06:03:45 [PATCH] explain tup_fetched/returned in monitoring-stats
Previous Message Peter Eisentraut 2012-10-12 05:38:24 line type