Re: GetSubscriptionRelations declares too many scan keys

Поиск
Список
Период
Сортировка
От Peter Smith
Тема Re: GetSubscriptionRelations declares too many scan keys
Дата
Msg-id CAHut+PutJbJhDNKU36iwYwvBofGRUB+sbXiT7QpuROGvneSstQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: GetSubscriptionRelations declares too many scan keys  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Ответы Re: GetSubscriptionRelations declares too many scan keys  (Julien Rouhaud <rjuju123@gmail.com>)
Список pgsql-hackers
On Mon, May 10, 2021 at 6:09 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> On Mon, May 10, 2021 at 12:36 PM Peter Smith <smithpb2250@gmail.com> wrote:
> >
> > The function GetSubscriptionRelations was declaring ScanKeyData
> > skey[2]; but actually
> > only uses 1 scan key. It seems like the code was cut/paste from other
> > nearby functions
> > which really are using 2 keys.
> >
> > PSA a trivial patch to declare the correct number of keys for this function.
>
> +1 for the change. It looks like a cut/paste type introduced by the
> commit 7c4f52409a.
>
> A comment on the patch: why do we need to declare an array of 1
> element ScanKeyData skey[1];? Instead, can we just do ScanKeyData
> skey;?

IMO declaring skey[1] is better because then the code can share the
same pattern as every other ScanData skey[n] code.

Please search PG source code for "ScanData skey[1];" - there are
dozens of precedents where other people felt the same as me for
declaring single keys.

--------
Kind Regards,
Peter Smith.
Fujitsu Australia



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dilip Kumar
Дата:
Сообщение: Re: Race condition in recovery?
Следующее
От: Greg Nancarrow
Дата:
Сообщение: Executor code - found an instance of a WHILE that should just be an IF