Re: Syntax for partitioning
Nikhil Sontakke <nikhil.sontakke@enterprisedb.com>
From: Nikhil Sontakke <nikhil.sontakke@enterprisedb.com>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>, Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>, pgsql-hackers@postgresql.org
Date: 2009-11-20T05:44:58Z
Lists: 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