Re: Syntax for partitioning

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Syntax for partitioning
Дата
Msg-id 1258670035.26726.21.camel@vanquo.pezone.net
обсуждение исходный текст
Ответ на Re: Syntax for partitioning  (Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Ответы Re: Syntax for partitioning
Re: Syntax for partitioning
Список pgsql-hackers
On ons, 2009-11-18 at 13:52 +0900, Itagaki Takahiro wrote:
> > partinfo = (PartitionInfo *) malloc(ntups * sizeof(PartitionInfo));
> 
> Oops, it should be "p"alloc. Thanks.

A very low-level comment:

1) Please stop casting the results of palloc and malloc.  We are not
writing C++ here.

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));



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

Предыдущее
От: Andrew Gierth
Дата:
Сообщение: Re: Timezones (in 8.5?)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Union test case broken in make check?