<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.67 2001/05/17 17:44:17 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.68 2001/06/18 16:14:43 momjian Exp $
-->
<Chapter Id="runtime">
</listitem>
</varlistentry>
+ <term>AUSTRALIAN_TIMEZONES (<type>bool</type>)</term>
+ <listitem>
+ <para>
+ If set to true, <literal>CST</literal>, <literal>EST</literal>,
+ and <literal>SAT</literal> are interpreted as Australian
+ timezones rather than as North American Central/Eastern
+ Timezones and Saturday. The default is false.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<indexterm>
<primary>SSL</primary>
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.64 2001/05/03 22:53:07 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.65 2001/06/18 16:14:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <limits.h>
#include "miscadmin.h"
+#include "utils/guc.h"
#include "utils/datetime.h"
static int DecodeNumber(int flen, char *field,
static datetkn *datebsearch(char *key, datetkn *base, unsigned int nel);
static int DecodeDate(char *str, int fmask, int *tmask, struct tm * tm);
-#define USE_DATE_CACHE 1
#define ROUND_ALL 0
static int DecodePosixTimezone(char *str, int *val);
{"cdt", DTZ, NEG(30)}, /* Central Daylight Time */
{"cet", TZ, 6}, /* Central European Time */
{"cetdst", DTZ, 12}, /* Central European Dayl.Time */
-#if USE_AUSTRALIAN_RULES
- {"cst", TZ, 63}, /* Australia Eastern Std Time */
-#else
{"cst", TZ, NEG(36)}, /* Central Standard Time */
-#endif
{DCURRENT, RESERV, DTK_CURRENT}, /* "current" is always now */
{"dec", MONTH, 12},
{"december", MONTH, 12},
{"eet", TZ, 12}, /* East. Europe, USSR Zone 1 */
{"eetdst", DTZ, 18}, /* Eastern Europe */
{EPOCH, RESERV, DTK_EPOCH}, /* "epoch" reserved for system epoch time */
-#if USE_AUSTRALIAN_RULES
- {"est", TZ, 60}, /* Australia Eastern Std Time */
-#else
{"est", TZ, NEG(30)}, /* Eastern Standard Time */
-#endif
{"feb", MONTH, 2},
{"february", MONTH, 2},
{"fri", DOW, 5},
{"pst", TZ, NEG(48)}, /* Pacific Standard Time */
{"sadt", DTZ, 63}, /* S. Australian Dayl. Time */
{"sast", TZ, 57}, /* South Australian Std Time */
-#if USE_AUSTRALIAN_RULES
- {"sat", TZ, 57},
-#else
{"sat", DOW, 6},
-#endif
{"saturday", DOW, 6},
{"sep", MONTH, 9},
{"sept", MONTH, 9},
static unsigned int szdatetktbl = sizeof datetktbl / sizeof datetktbl[0];
+/* Used for SET australian_timezones to override North American ones */
+static datetkn australian_datetktbl[] = {
+ {"cst", TZ, 63}, /* Australia Eastern Std Time */
+ {"est", TZ, 60}, /* Australia Eastern Std Time */
+ {"sat", TZ, 57},
+};
+
+static unsigned int australian_szdatetktbl = sizeof australian_datetktbl /
+ sizeof australian_datetktbl[0];
+
static datetkn deltatktbl[] = {
/* text token lexval */
{"@", IGNORE, 0}, /* postgres relative time prefix */
static unsigned int szdeltatktbl = sizeof deltatktbl / sizeof deltatktbl[0];
-#if USE_DATE_CACHE
datetkn *datecache[MAXDATEFIELDS] = {NULL};
datetkn *deltacache[MAXDATEFIELDS] = {NULL};
-#endif
-
/*
* Calendar time to Julian date conversions.
int type;
datetkn *tp;
-#if USE_DATE_CACHE
if ((datecache[field] != NULL)
&& (strncmp(lowtoken, datecache[field]->token, TOKMAXLEN) == 0))
tp = datecache[field];
else
{
-#endif
- tp = datebsearch(lowtoken, datetktbl, szdatetktbl);
-#if USE_DATE_CACHE
+ tp = NULL;
+ if (Australian_timezones)
+ tp = datebsearch(lowtoken, australian_datetktbl,
+ australian_szdatetktbl);
+ if (!tp)
+ tp = datebsearch(lowtoken, datetktbl, szdatetktbl);
}
datecache[field] = tp;
-#endif
if (tp == NULL)
{
type = IGNORE;
int type;
datetkn *tp;
-#if USE_DATE_CACHE
if ((deltacache[field] != NULL)
&& (strncmp(lowtoken, deltacache[field]->token, TOKMAXLEN) == 0))
tp = deltacache[field];
else
{
-#endif
tp = datebsearch(lowtoken, deltatktbl, szdeltatktbl);
-#if USE_DATE_CACHE
}
deltacache[field] = tp;
-#endif
if (tp == NULL)
{
type = IGNORE;
return 0;
} /* EncodeTimeSpan() */
+
+
+void ClearDateCache(bool dummy)
+{
+ int i;
+
+ for (i=0; i < MAXDATEFIELDS; i++)
+ datecache[i] = NULL;
+}
* Support for grand unified configuration scheme, including SET
* command, configuration file, and command line options.
*
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.38 2001/06/12 22:54:06 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.39 2001/06/18 16:14:43 momjian Exp $
*
* Copyright 2000 by PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
#include "parser/parse_expr.h"
#include "storage/proc.h"
#include "tcop/tcopprot.h"
+#include "utils/datetime.h"
/* XXX these should be in other modules' header files */
bool SQL_inheritance = true;
+bool Australian_timezones = false;
+
#ifndef PG_KRB_SRVTAB
#define PG_KRB_SRVTAB ""
#endif
{"sql_inheritance", PGC_USERSET, &SQL_inheritance, true, NULL},
+ {"australian_timezones", PGC_USERSET, &Australian_timezones,
+ false, ClearDateCache},
+
{"fixbtree", PGC_POSTMASTER, &FixBTree, true, NULL},
{NULL, 0, NULL, false, NULL}
DEFAULT_CPU_OPERATOR_COST, 0, DBL_MAX, NULL, NULL},
{"geqo_selection_bias", PGC_USERSET, &Geqo_selection_bias,
- DEFAULT_GEQO_SELECTION_BIAS, MIN_GEQO_SELECTION_BIAS,
- MAX_GEQO_SELECTION_BIAS, NULL, NULL},
+ DEFAULT_GEQO_SELECTION_BIAS, MIN_GEQO_SELECTION_BIAS,
+ MAX_GEQO_SELECTION_BIAS, NULL, NULL},
{NULL, 0, NULL, 0.0, 0.0, 0.0, NULL, NULL}
};
"", NULL, NULL},
{"wal_sync_method", PGC_SIGHUP, &XLOG_sync_method,
- XLOG_sync_method_default,
- check_xlog_sync_method, assign_xlog_sync_method},
+ XLOG_sync_method_default, check_xlog_sync_method,
+ assign_xlog_sync_method},
{NULL, 0, NULL, NULL, NULL, NULL}
};
case PGC_BOOL:
val = *((struct config_bool *) record)->variable ? "on" : "off";
break;
+
case PGC_INT:
snprintf(buffer, sizeof(buffer), "%d",
*((struct config_int *) record)->variable);
#geqo_random_seed = -1 # auto-compute seed
-#
-# Inheritance
-#
-#sql_inheritance = true
-
-
-#
-# Deadlock
-#
-#deadlock_timeout = 1000
-
-
-#
-# Expression Depth Limitation
-#
-#max_expr_depth = 10000 # min 10
-
-
#
# Write-ahead log (WAL)
#
#trace_lock_oidmin = 16384
#trace_lock_table = 0
#endif
+
+
+#
+# Misc
+#
+#sql_inheritance = true
+#australian_timezones = false
+#deadlock_timeout = 1000
+#max_expr_depth = 10000 # min 10
+
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: datetime.h,v 1.18 2001/05/03 22:53:07 tgl Exp $
+ * $Id: datetime.h,v 1.19 2001/06/18 16:14:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
char value; /* this may be unsigned, alas */
} datetkn;
+extern datetkn datetktbl[];
/* TMODULO()
* Macro to replace modf(), which is broken on some platforms.
extern int DecodeSpecial(int field, char *lowtoken, int *val);
extern int DecodeUnits(int field, char *lowtoken, int *val);
+extern void ClearDateCache(bool);
extern int j2day(int jd);
* External declarations pertaining to backend/utils/misc/guc.c and
* backend/utils/misc/guc-file.l
*
- * $Id: guc.h,v 1.8 2001/06/12 22:54:06 tgl Exp $
+ * $Id: guc.h,v 1.9 2001/06/18 16:14:43 momjian Exp $
*/
#ifndef GUC_H
#define GUC_H
extern bool Show_btree_build_stats;
extern bool SQL_inheritance;
+extern bool Australian_timezones;
#endif /* GUC_H */
--
-- date, time arithmetic
--
+-- needed so tests pass
+SET australian_timezones = 'off';
SELECT date '1981-02-03' + time '04:05:06' AS "Date + Time";
Date + Time
------------------------------
--
-- date, time arithmetic
--
+-- needed so tests pass
+SET australian_timezones = 'off';
SELECT date '1981-02-03' + time '04:05:06' AS "Date + Time";
Date + Time
------------------------------
--
-- date, time arithmetic
--
+-- needed so tests pass
+SET australian_timezones = 'off';
SELECT date '1981-02-03' + time '04:05:06' AS "Date + Time";
Date + Time
------------------------------
-- Shorthand values
-- Not directly usable for regression testing since these are not constants.
-- So, just try to test parser and hope for the best - thomas 97/04/26
+-- needed so tests pass
+SET australian_timezones = 'off';
SELECT (timestamp 'today' = (timestamp 'yesterday' + interval '1 day')) as "True";
True
------
--
-- HOROLOGY
--
-
--
-- date, time arithmetic
--
+-- needed so tests pass
+SET australian_timezones = 'off';
SELECT date '1981-02-03' + time '04:05:06' AS "Date + Time";
--
-- DATETIME
--
-
-- Shorthand values
-- Not directly usable for regression testing since these are not constants.
-- So, just try to test parser and hope for the best - thomas 97/04/26
+-- needed so tests pass
+SET australian_timezones = 'off';
SELECT (timestamp 'today' = (timestamp 'yesterday' + interval '1 day')) as "True";
SELECT (timestamp 'today' = (timestamp 'tomorrow' - interval '1 day')) as "True";