Re: fastgetattr & isNull

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: fastgetattr & isNull
Date: 2010-01-06 18:05:06
Message-ID: 19485.1262801106@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> The fastgetattr() attempts to make provision for the case where isnull
> is a NULL pointer, but it doesn't seem to work. I tried it and got:

> relcache.c:494: error: invalid use of void expression
> relcache.c:494: error: invalid use of void expression
> relcache.c:494: warning: left-hand operand of comma expression has no effect
> relcache.c:494: warning: left-hand operand of comma expression has no effect

Hmm. I think the macro means to handle the case where the argument is a
pointer variable whose value is null, not the case of writing "NULL" as
a literal argument.

Still, it's not entirely clear to me why ignoring the possibility of
a null value would be a good idea. So far as I can see, we have at
least the following coding pattern everywhere this is used:

fastgetattr(..., &isnull);
Assert(!isnull);

and I don't think it's good coding style to go without even an Assert.
So +1 for removing the support for a null pointer ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2010-01-06 18:08:05 Re: [HACKERS] tribble.postgresql.org - planned maintenance downtime
Previous Message Jaime Casanova 2010-01-06 18:03:33 Re: [HACKERS] tribble.postgresql.org - planned maintenance downtime