Re: Syntax for partitioning - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Syntax for partitioning
Date
Msg-id 1258670035.26726.21.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: Syntax for partitioning  (Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: Syntax for partitioning
Re: Syntax for partitioning
List 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 by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: Timezones (in 8.5?)
Next
From: Tom Lane
Date:
Subject: Re: Union test case broken in make check?