diff --git a/configure b/configure
new file mode 100755
index 7dcca50..d6945eb
*** a/configure
--- b/configure
*************** else
*** 12655,12661 ****
      We can't simply define LARGE_OFF_T to be 9223372036854775807,
      since some C++ compilers masquerading as C compilers
      incorrectly reject 9223372036854775807.  */
! #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  		       && LARGE_OFF_T % 2147483647 == 1)
  		      ? 1 : -1];
--- 12655,12661 ----
      We can't simply define LARGE_OFF_T to be 9223372036854775807,
      since some C++ compilers masquerading as C compilers
      incorrectly reject 9223372036854775807.  */
! #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  		       && LARGE_OFF_T % 2147483647 == 1)
  		      ? 1 : -1];
*************** else
*** 12701,12707 ****
      We can't simply define LARGE_OFF_T to be 9223372036854775807,
      since some C++ compilers masquerading as C compilers
      incorrectly reject 9223372036854775807.  */
! #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  		       && LARGE_OFF_T % 2147483647 == 1)
  		      ? 1 : -1];
--- 12701,12707 ----
      We can't simply define LARGE_OFF_T to be 9223372036854775807,
      since some C++ compilers masquerading as C compilers
      incorrectly reject 9223372036854775807.  */
! #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  		       && LARGE_OFF_T % 2147483647 == 1)
  		      ? 1 : -1];
*************** rm -f core conftest.err conftest.$ac_obj
*** 12725,12731 ****
      We can't simply define LARGE_OFF_T to be 9223372036854775807,
      since some C++ compilers masquerading as C compilers
      incorrectly reject 9223372036854775807.  */
! #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  		       && LARGE_OFF_T % 2147483647 == 1)
  		      ? 1 : -1];
--- 12725,12731 ----
      We can't simply define LARGE_OFF_T to be 9223372036854775807,
      since some C++ compilers masquerading as C compilers
      incorrectly reject 9223372036854775807.  */
! #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  		       && LARGE_OFF_T % 2147483647 == 1)
  		      ? 1 : -1];
*************** else
*** 12770,12776 ****
      We can't simply define LARGE_OFF_T to be 9223372036854775807,
      since some C++ compilers masquerading as C compilers
      incorrectly reject 9223372036854775807.  */
! #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  		       && LARGE_OFF_T % 2147483647 == 1)
  		      ? 1 : -1];
--- 12770,12776 ----
      We can't simply define LARGE_OFF_T to be 9223372036854775807,
      since some C++ compilers masquerading as C compilers
      incorrectly reject 9223372036854775807.  */
! #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  		       && LARGE_OFF_T % 2147483647 == 1)
  		      ? 1 : -1];
*************** rm -f core conftest.err conftest.$ac_obj
*** 12794,12800 ****
      We can't simply define LARGE_OFF_T to be 9223372036854775807,
      since some C++ compilers masquerading as C compilers
      incorrectly reject 9223372036854775807.  */
! #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  		       && LARGE_OFF_T % 2147483647 == 1)
  		      ? 1 : -1];
--- 12794,12800 ----
      We can't simply define LARGE_OFF_T to be 9223372036854775807,
      since some C++ compilers masquerading as C compilers
      incorrectly reject 9223372036854775807.  */
! #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  		       && LARGE_OFF_T % 2147483647 == 1)
  		      ? 1 : -1];
*************** $as_echo "#define HAVE_INT_OPTRESET 1" >
*** 13962,13967 ****
--- 13962,13979 ----
  
  fi
  
+ for ac_func in atoll atoq
+ do :
+   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+ if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+   cat >>confdefs.h <<_ACEOF
+ #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+ _ACEOF
+  break
+ fi
+ done
+ 
  for ac_func in strtoll strtoq
  do :
    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
diff --git a/configure.in b/configure.in
new file mode 100644
index 4d26034..1feb1e0
*** a/configure.in
--- b/configure.in
*************** if test x"$pgac_cv_var_int_optreset" = x
*** 1646,1651 ****
--- 1646,1652 ----
    AC_DEFINE(HAVE_INT_OPTRESET, 1, [Define to 1 if you have the global variable 'int optreset'.])
  fi
  
+ AC_CHECK_FUNCS([atoll atoq], [break])
  AC_CHECK_FUNCS([strtoll strtoq], [break])
  AC_CHECK_FUNCS([strtoull strtouq], [break])
  
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
new file mode 100644
index 06bbc50..689e4dc
*** a/src/bin/pg_dump/pg_dump.c
--- b/src/bin/pg_dump/pg_dump.c
*************** dumpSequence(Archive *fout, TableInfo *t
*** 16843,16848 ****
--- 16843,16850 ----
  			   *seqtype;
  	bool		cycled;
  	bool		is_ascending;
+ 	int64		default_minv,
+ 				default_maxv;
  	PQExpBuffer query = createPQExpBuffer();
  	PQExpBuffer delqry = createPQExpBuffer();
  	PQExpBuffer labelq = createPQExpBuffer();
*************** dumpSequence(Archive *fout, TableInfo *t
*** 16914,16951 ****
  
  	is_ascending = incby[0] != '-';
  
! 	if (is_ascending && atoi(minv) == 1)
! 		minv = NULL;
! 	if (!is_ascending && atoi(maxv) == -1)
! 		maxv = NULL;
! 
  	if (strcmp(seqtype, "smallint") == 0)
  	{
! 		if (!is_ascending && atoi(minv) == PG_INT16_MIN)
! 			minv = NULL;
! 		if (is_ascending && atoi(maxv) == PG_INT16_MAX)
! 			maxv = NULL;
  	}
  	else if (strcmp(seqtype, "integer") == 0)
  	{
! 		if (!is_ascending && atoi(minv) == PG_INT32_MIN)
! 			minv = NULL;
! 		if (is_ascending && atoi(maxv) == PG_INT32_MAX)
! 			maxv = NULL;
  	}
  	else if (strcmp(seqtype, "bigint") == 0)
  	{
! 		char		bufm[100],
! 					bufx[100];
! 
! 		snprintf(bufm, sizeof(bufm), INT64_FORMAT, PG_INT64_MIN);
! 		snprintf(bufx, sizeof(bufx), INT64_FORMAT, PG_INT64_MAX);
! 
! 		if (!is_ascending && strcmp(minv, bufm) == 0)
! 			minv = NULL;
! 		if (is_ascending && strcmp(maxv, bufx) == 0)
! 			maxv = NULL;
  	}
  
  	/*
  	 * DROP must be fully qualified in case same name appears in pg_catalog
--- 16916,16947 ----
  
  	is_ascending = incby[0] != '-';
  
! 	/* Calculate default limits for a sequence of this kind */
  	if (strcmp(seqtype, "smallint") == 0)
  	{
! 		default_minv = is_ascending ? 1 : PG_INT16_MIN;
! 		default_maxv = is_ascending ? PG_INT16_MAX : -1;
  	}
  	else if (strcmp(seqtype, "integer") == 0)
  	{
! 		default_minv = is_ascending ? 1 : PG_INT32_MIN;
! 		default_maxv = is_ascending ? PG_INT32_MAX : -1;
  	}
  	else if (strcmp(seqtype, "bigint") == 0)
  	{
! 		default_minv = is_ascending ? 1 : PG_INT64_MIN;
! 		default_maxv = is_ascending ? PG_INT64_MAX : -1;
  	}
+ 	else
+ 	{
+ 		exit_horribly(NULL, "unrecognized sequence type: %s\n",
+ 					  seqtype);
+ 	}
+ 
+ 	if (atoint64(minv) == default_minv)
+ 		minv = NULL;
+ 	if (atoint64(maxv) == default_maxv)
+ 		maxv = NULL;
  
  	/*
  	 * DROP must be fully qualified in case same name appears in pg_catalog
diff --git a/src/include/c.h b/src/include/c.h
new file mode 100644
index 37c0c39..4ff57f3
*** a/src/include/c.h
--- b/src/include/c.h
*************** typedef unsigned long int uint64;
*** 336,341 ****
--- 336,342 ----
  #endif
  #define INT64CONST(x)  (x##L)
  #define UINT64CONST(x) (x##UL)
+ #define atoint64 atol
  #elif defined(HAVE_LONG_LONG_INT_64)
  /* We have working support for "long long int", use that */
  
*************** typedef unsigned long long int uint64;
*** 347,352 ****
--- 348,354 ----
  #endif
  #define INT64CONST(x)  (x##LL)
  #define UINT64CONST(x) (x##ULL)
+ #define atoint64 atoll
  #else
  /* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */
  #error must have a working 64-bit integer datatype
*************** extern int	vsnprintf(char *str, size_t c
*** 1125,1130 ****
--- 1127,1138 ----
  extern int	fdatasync(int fildes);
  #endif
  
+ /* If atoq() exists, rename it to the more standard atoll() */
+ #if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_ATOLL) && defined(HAVE_ATOQ)
+ #define atoll atoq
+ #define HAVE_ATOLL 1
+ #endif
+ 
  /* If strtoq() exists, rename it to the more standard strtoll() */
  #if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
  #define strtoll strtoq
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
new file mode 100644
index f98f773..281756a
*** a/src/include/pg_config.h.in
--- b/src/include/pg_config.h.in
***************
*** 90,101 ****
--- 90,107 ----
  /* Define to 1 if you have the `ASN1_STRING_get0_data' function. */
  #undef HAVE_ASN1_STRING_GET0_DATA
  
+ /* Define to 1 if you have the `atoll' function. */
+ #undef HAVE_ATOLL
+ 
  /* Define to 1 if you want to use atomics if available. */
  #undef HAVE_ATOMICS
  
  /* Define to 1 if you have the <atomic.h> header file. */
  #undef HAVE_ATOMIC_H
  
+ /* Define to 1 if you have the `atoq' function. */
+ #undef HAVE_ATOQ
+ 
  /* Define to 1 if you have the `BIO_get_data' function. */
  #undef HAVE_BIO_GET_DATA
  
