Re: BUG #15623: Inconsistent use of default for updatable view - Mailing list pgsql-bugs

From Dean Rasheed
Subject Re: BUG #15623: Inconsistent use of default for updatable view
Date
Msg-id CAEZATCWFURkSW8CsKih=hqpOGz+JkvuBDtGmtWc-GrZEfahjFg@mail.gmail.com
Whole thread Raw
In response to Re: BUG #15623: Inconsistent use of default for updatable view  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-bugs
On Thu, 28 Feb 2019 at 07:47, Amit Langote
<Langote_Amit_f8@lab.ntt.co.jp> wrote:
>
> +                if (attrno == 0)
> +                    elog(ERROR, "Cannot set value in column %d to
> DEFAULT", i);
>
> Maybe: s/Cannot/cannot/g
>

Ah yes, you're right. That is the convention.


> +        Assert(list_length(sublist) == numattrs);
>
> Isn't this Assert useless, because we're setting numattrs to
> list_length(<first-sublist>) and transformInsertStmt ensures that all
> sublists are same length?
>

Well possibly I'm being over-paranoid, but given that it may have come
via a previous invocation of rewriteValuesRTE() that may have
completely rebuilt the lists, it seemed best to be sure that it hadn't
done something unexpected. It's about to use that to read from the
attrnos array, so it might read beyond the array bounds if any of the
prior logic was faulty.

Thanks for looking.

Regards,
Dean


pgsql-bugs by date:

Previous
From: "Serbin, Ilya"
Date:
Subject: Re: BUG #15660: pg_dump memory leaks when dumping LOBs
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #15661: Error connecting to the server