#include "nodes/makefuncs.h"
 #include "utils/array.h"
 #include "utils/builtins.h"
+#include "utils/guc.h"
 #include "utils/rel.h"
 
 
 {
        static const char *const default_keywords[1] = {"fillfactor"};
        char       *values[1];
-       int32           fillfactor;
+       int                     fillfactor;
        StdRdOptions *result;
 
        parseRelOptions(reloptions, 1, default_keywords, values, validate);
        if (values[0] == NULL)
                return NULL;
 
-       fillfactor = pg_atoi(values[0], sizeof(int32), 0);
+       if (!parse_int(values[0], &fillfactor, 0, NULL))
+       {
+               if (validate)
+                       ereport(ERROR,
+                                       (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+                                        errmsg("fillfactor must be an integer: \"%s\"",
+                                                       values[0])));
+               return NULL;
+       }
+
        if (fillfactor < minFillfactor || fillfactor > 100)
        {
                if (validate)
 
  * If not okay and hintmsg is not NULL, *hintmsg is set to a suitable
  *     HINT message, or NULL if no hint provided.
  */
-static bool
+bool
 parse_int(const char *value, int *result, int flags, const char **hintmsg)
 {
        int64           val;
  * If the string parses okay, return true, else false.
  * If okay and result is not NULL, return the value in *result.
  */
-static bool
+bool
 parse_real(const char *value, double *result)
 {
        double          val;
 
 extern void BeginReportingGUCOptions(void);
 extern void ParseLongOption(const char *string, char **name, char **value);
 extern bool parse_bool(const char *value, bool *result);
+extern bool parse_int(const char *value, int *result, int flags,
+                                         const char **hintmsg);
+extern bool parse_real(const char *value, double *result);
 extern bool set_config_option(const char *name, const char *value,
                                  GucContext context, GucSource source,
                                  GucAction action, bool changeVal);