Re: Syntax for partitioning

Поиск
Список
Период
Сортировка
От Nikhil Sontakke
Тема Re: Syntax for partitioning
Дата
Msg-id a301bfd90911192144g41ce4a2do50cfefe75a47615f@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Syntax for partitioning  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Syntax for partitioning
Re: Syntax for partitioning
Список pgsql-hackers
Hi,

>> > partinfo = (PartitionInfo *) malloc(ntups * sizeof(PartitionInfo));
>
> 1) Please stop casting the results of palloc and malloc.  We are not
> writing C++ here.
>

I thought it was/is a good C programming practice to typecast (void *)
always to the returning structure type!!

Regards,
Nikhils

> 2) I would prefer that you apply sizeof on the variable, not on the
> type.  That way, the expression is independent of any type changes of
> the variable, and can be reviewed without having to scroll around for
> the variable definition.
>
> So how about,
>
> partinfo = palloc(ntups * sizeof(*partinfo));
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>



--
http://www.enterprisedb.com


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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: operator exclusion constraints
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Union test case broken in make check?