From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Дмитрий Воронин <carriingfate92(at)yandex(dot)ru>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Warnings in objectaddress.c |
Date: | 2017-10-04 11:58:19 |
Message-ID: | CA+TgmoYZBHc+Ny6PKum8eCAhWWhF5wuXJsSsykZJCsQDPPWg6A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Oct 3, 2017 at 9:41 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> Perhaps we should apply some glorified version of this:
>
>> + if (list_length(object) < 2)
>> + elog(ERROR, "fail");
>
>> However, I'm not 100% sure that would be sufficient to suppress these
>> warnings, because the compiler has got to be smart enough to know that
>> elog() doesn't return and that i >= 2 is sufficient to guarantee that
>> everything is initialized.
>
> I'm betting it wouldn't help. I was considering something along the line
> of unrolling the loop:
>
> Assert(list_length(object) == 2);
>
> assign typenames[0] and typeoids[0] from linitial(object)
>
> assign typenames[1] and typeoids[1] from lsecond(object)
>
> This would involve duplicating the loop body, but that's only 3 lines,
> so I think it wouldn't even net out as more code.
Yeah, that's an idea, too.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2017-10-04 12:02:28 | Re: Another oddity in handling of WCO constraints in postgres_fdw |
Previous Message | Robert Haas | 2017-10-04 11:54:06 | Re: Re: protocol version negotiation (Re: Libpq PGRES_COPY_BOTH - version compatibility) |