Ron Peterson <[EMAIL PROTECTED]> writes:
> Datum
> y_somefunc ( PG_FUNCTION_ARGS )
> {
>    if( PG_ARGISNULL(0) ||
>        PG_ARGISNULL(1) ||
>        PG_ARGISNULL(2) )
>    {
>       PG_RETURN_NULL();
>    }
>    text* rand_dev = PG_GETARG_TEXT_P(0);
>    ...

> Should I be concerned by this?  What's the proper way to code this?

The proper way to code that is either

{
   text* rand_dev;

   if( PG_ARGISNULL(0) ||
       PG_ARGISNULL(1) ||
       PG_ARGISNULL(2) )
   {
      PG_RETURN_NULL();
   }
   rand_dev = PG_GETARG_TEXT_P(0);
   ...

or probably better, declare the function STRICT and drop the runtime
ARGISNULL tests entirely.

> I'm thinking the correct answer is "just live with
> it until your version of gcc uses c99 as the default standard".

Declarations in the middle of a code block are C++, not C; if you
try to hold your breath until your C compiler accepts it, you will die.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to