Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2169e42

Browse files
author
Neil Conway
committed
Enable 64-bit integer datetimes by default, per previous discussion.
This requires a working 64-bit integer type. If such a type cannot be found, "--disable-integer-datetimes" can be used to switch back to the previous floating point-based datetime implementation.
1 parent 2f6e61b commit 2169e42

File tree

5 files changed

+88
-36
lines changed

5 files changed

+88
-36
lines changed

configure

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ if test -n "$ac_init_help"; then
13491349
Optional Features:
13501350
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
13511351
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
1352-
--enable-integer-datetimes enable 64-bit integer date/time support
1352+
--disable-integer-datetimes disable 64-bit integer date/time support
13531353
--enable-nls[=LANGUAGES] enable Native Language Support
13541354
--disable-shared do not build shared libraries
13551355
--disable-rpath do not embed shared library search path in executables
@@ -2176,7 +2176,7 @@ fi
21762176

21772177

21782178
#
2179-
# 64-bit integer date/time storage (--enable-integer-datetimes)
2179+
# 64-bit integer date/time storage: enabled by default.
21802180
#
21812181
{ echo "$as_me:$LINENO: checking whether to build with 64-bit integer date/time support" >&5
21822182
echo $ECHO_N "checking whether to build with 64-bit integer date/time support... $ECHO_C" >&6; }
@@ -2205,7 +2205,11 @@ echo "$as_me: error: no argument expected for --enable-integer-datetimes option"
22052205
esac
22062206

22072207
else
2208-
enable_integer_datetimes=no
2208+
enable_integer_datetimes=yes
2209+
2210+
cat >>confdefs.h <<\_ACEOF
2211+
#define USE_INTEGER_DATETIMES 1
2212+
_ACEOF
22092213

22102214
fi
22112215

@@ -23293,6 +23297,26 @@ fi
2329323297

2329423298

2329523299

23300+
# If the user did not disable integer datetimes, check that
23301+
# there is a working 64-bit integral type to use.
23302+
if test x"$USE_INTEGER_DATETIMES" = x"yes" &&
23303+
test x"$HAVE_LONG_INT_64" = x"no" &&
23304+
test x"$HAVE_LONG_LONG_INT_64" = x"no" &&
23305+
test x"$HAVE_INT64" = x"no" ; then
23306+
{ { echo "$as_me:$LINENO: error:
23307+
Integer-based datetime support requires a 64-bit integer type,
23308+
but no such type could be found. The --disable-integer-datetimes
23309+
configure option can be used to disable integer-based storage
23310+
of datetime values." >&5
23311+
echo "$as_me: error:
23312+
Integer-based datetime support requires a 64-bit integer type,
23313+
but no such type could be found. The --disable-integer-datetimes
23314+
configure option can be used to disable integer-based storage
23315+
of datetime values." >&2;}
23316+
{ (exit 1); exit 1; }; }
23317+
fi
23318+
23319+
2329623320
if test "$PORTNAME" != "win32"
2329723321
then
2329823322
{ echo "$as_me:$LINENO: checking for POSIX signal interface" >&5

configure.in

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.554 2008/03/10 21:50:16 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.555 2008/03/30 04:08:14 neilc Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -128,10 +128,10 @@ PGAC_ARG_REQ(with, libs, [ --with-libs=DIRS alternative spelling of
128128

129129

130130
#
131-
# 64-bit integer date/time storage (--enable-integer-datetimes)
131+
# 64-bit integer date/time storage: enabled by default.
132132
#
133133
AC_MSG_CHECKING([whether to build with 64-bit integer date/time support])
134-
PGAC_ARG_BOOL(enable, integer-datetimes, no, [ --enable-integer-datetimes enable 64-bit integer date/time support],
134+
PGAC_ARG_BOOL(enable, integer-datetimes, yes, [ --disable-integer-datetimes disable 64-bit integer date/time support],
135135
[AC_DEFINE([USE_INTEGER_DATETIMES], 1,
136136
[Define to 1 if you want 64-bit integer timestamp and interval support. (--enable-integer-datetimes)])])
137137
AC_MSG_RESULT([$enable_integer_datetimes])
@@ -1405,6 +1405,20 @@ AC_CHECK_TYPES([int8, uint8, int64, uint64], [], [],
14051405
AC_CHECK_TYPES(sig_atomic_t, [], [], [#include <signal.h>])
14061406

14071407

1408+
# If the user did not disable integer datetimes, check that
1409+
# there is a working 64-bit integral type to use.
1410+
if test x"$USE_INTEGER_DATETIMES" = x"yes" &&
1411+
test x"$HAVE_LONG_INT_64" = x"no" &&
1412+
test x"$HAVE_LONG_LONG_INT_64" = x"no" &&
1413+
test x"$HAVE_INT64" = x"no" ; then
1414+
AC_MSG_ERROR([
1415+
Integer-based datetime support requires a 64-bit integer type,
1416+
but no such type could be found. The --disable-integer-datetimes
1417+
configure option can be used to disable integer-based storage
1418+
of datetime values.])
1419+
fi
1420+
1421+
14081422
if test "$PORTNAME" != "win32"
14091423
then
14101424
PGAC_FUNC_POSIX_SIGNALS

doc/src/sgml/config.sgml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.173 2008/03/11 16:59:00 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.174 2008/03/30 04:08:14 neilc Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -4740,11 +4740,11 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
47404740
</indexterm>
47414741
<listitem>
47424742
<para>
4743-
Reports whether <productname>PostgreSQL</productname> was built
4744-
with support for 64-bit-integer dates and times. It is set by
4745-
configuring with <literal>--enable-integer-datetimes</literal>
4746-
when building <productname>PostgreSQL</productname>. The
4747-
default value is <literal>off</literal>.
4743+
Reports whether <productname>PostgreSQL</> was built with
4744+
support for 64-bit-integer dates and times. This can be
4745+
disabled by configuring with <literal>--disable-integer-datetimes</>
4746+
when building <productname>PostgreSQL</>. The default value is
4747+
<literal>on</literal>.
47484748
</para>
47494749
</listitem>
47504750
</varlistentry>

doc/src/sgml/datatype.sgml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.225 2008/02/16 21:51:04 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.226 2008/03/30 04:08:14 neilc Exp $ -->
22

33
<chapter id="datatype">
44
<title id="datatype-title">Data Types</title>
@@ -1408,15 +1408,15 @@ SELECT b, char_length(b) FROM test2;
14081408
<entry>8 bytes</entry>
14091409
<entry>both date and time</entry>
14101410
<entry>4713 BC</entry>
1411-
<entry>5874897 AD</entry>
1411+
<entry>294276 AD</entry>
14121412
<entry>1 microsecond / 14 digits</entry>
14131413
</row>
14141414
<row>
14151415
<entry><type>timestamp [ (<replaceable>p</replaceable>) ] with time zone</type></entry>
14161416
<entry>8 bytes</entry>
14171417
<entry>both date and time, with time zone</entry>
14181418
<entry>4713 BC</entry>
1419-
<entry>5874897 AD</entry>
1419+
<entry>294276 AD</entry>
14201420
<entry>1 microsecond / 14 digits</entry>
14211421
</row>
14221422
<row>
@@ -1475,20 +1475,27 @@ SELECT b, char_length(b) FROM test2;
14751475

14761476
<note>
14771477
<para>
1478-
When <type>timestamp</> values are stored as double precision floating-point
1479-
numbers (currently the default), the effective limit of precision
1480-
might be less than 6. <type>timestamp</type> values are stored as seconds
1481-
before or after midnight 2000-01-01. Microsecond precision is achieved for
1482-
dates within a few years of 2000-01-01, but the precision degrades for
1483-
dates further away. When <type>timestamp</type> values are stored as
1484-
eight-byte integers (a compile-time
1485-
option), microsecond precision is available over the full range of
1486-
values. However eight-byte integer timestamps have a more limited range of
1487-
dates than shown above: from 4713 BC up to 294276 AD. The same
1488-
compile-time option also determines whether <type>time</type> and
1489-
<type>interval</type> values are stored as floating-point or eight-byte
1490-
integers. In the floating-point case, large <type>interval</type> values
1491-
degrade in precision as the size of the interval increases.
1478+
When <type>timestamp</> values are stored as eight-byte integers
1479+
(currently the default), microsecond precision is available over
1480+
the full range of values. When <type>timestamp</> values are
1481+
stored as double precision floating-point numbers instead (a
1482+
deprecated compile-time option), the effective limit of precision
1483+
might be less than 6. <type>timestamp</type> values are stored as
1484+
seconds before or after midnight 2000-01-01. When
1485+
<type>timestamp</type> values are implemented using floating-point
1486+
numbers, microsecond precision is achieved for dates within a few
1487+
years of 2000-01-01, but the precision degrades for dates further
1488+
away. Note that using floating-point datetimes allows a larger
1489+
range of <type>timestamp</type> values to be represented than
1490+
shown above: from 4713 BC up to 5874897 AD.
1491+
</para>
1492+
1493+
<para>
1494+
The same compile-time option also determines whether
1495+
<type>time</type> and <type>interval</type> values are stored as
1496+
floating-point numbers or eight-byte integers. In the
1497+
floating-point case, large <type>interval</type> values degrade in
1498+
precision as the size of the interval increases.
14921499
</para>
14931500
</note>
14941501

doc/src/sgml/installation.sgml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.305 2008/03/25 22:50:27 neilc Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.306 2008/03/30 04:08:15 neilc Exp $ -->
22

33
<chapter id="installation">
44
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -1011,16 +1011,23 @@ su - postgres
10111011
</varlistentry>
10121012

10131013
<varlistentry>
1014-
<term><option>--enable-integer-datetimes</option></term>
1014+
<term><option>--disable-integer-datetimes</option></term>
10151015
<listitem>
10161016
<para>
1017-
Use 64-bit integer storage for datetimes and intervals, rather
1018-
than the default floating-point storage. This reduces the range
1019-
of representable values but guarantees microsecond precision across
1020-
the full range (see
1017+
Disable support for 64-bit integer storage for timestamps and
1018+
intervals, and store datetime values as floating-point
1019+
numbers instead. Floating-point datetime storage was the
1020+
default in <productname>PostgreSQL</productname> releases
1021+
prior to 8.4, but it is now deprecated, because it does not
1022+
support microsecond precision for the full range of
1023+
<type>timestamp</type> values. However, integer-based
1024+
datetime storage requires a 64-bit integer type. Therefore,
1025+
this option can be used when no such type is available, or
1026+
for compatibility with applications written for prior
1027+
versions of <productname>PostgreSQL</productname>. See
10211028
<![%standalone-include[the documentation about datetime datatypes]]>
10221029
<![%standalone-ignore[<xref linkend="datatype-datetime">]]>
1023-
for more information).
1030+
for more information.
10241031
</para>
10251032
</listitem>
10261033
</varlistentry>

0 commit comments

Comments
 (0)