OSDN Git Service

Fix calling parameter of SPI_execute_plan
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Mon, 18 Jun 2018 06:56:24 +0000 (15:56 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Mon, 18 Jun 2018 07:03:26 +0000 (16:03 +0900)
Fixed a long-standing bug but having done no harm over all existing
versions. SPI_execute_plan's third paramter is char [] but it is
called with bool []. The bool value is false and it is different from
'n', which represents !is_null so it has been worked as expected as the
result.

pg_dbms_stats.c

index 09fca98..ce61e24 100644 (file)
@@ -1457,7 +1457,6 @@ execute_plan(SPIPlanPtr *plan,
        Oid             argtypes[3] = { OIDOID, INT2OID, BOOLOID };
        int             nargs;
        Datum   values[3];
-       bool    nulls[3] = { false, false, false };
        Oid                     save_userid;
        int                     save_sec_context;
 
@@ -1490,7 +1489,7 @@ execute_plan(SPIPlanPtr *plan,
                values[1] = Int16GetDatum(attnum ? *attnum : 0);
                values[2] = BoolGetDatum(inh);
 
-               ret = SPI_execute_plan(*plan, values, nulls, true, 1);
+               ret = SPI_execute_plan(*plan, values, NULL, true, 1);
        }
        PG_CATCH();
        {