From 6f58115dddfa8ca63004c4784f57ef660422861d Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Fri, 28 Sep 2001 08:09:14 +0000 Subject: Measure the current transaction time to milliseconds. Define a new function, GetCurrentTransactionStartTimeUsec() to get the time to this precision. Allow now() and timestamp 'now' to use this higher precision result so we now have fractional seconds in this "constant". Add timestamp without time zone type. Move previous timestamp type to timestamp with time zone. Accept another ISO variant for date/time values: yyyy-mm-ddThh:mm:ss (note the "T" separating the day from hours information). Remove 'current' from date/time types; convert to 'now' in input. Separate time and timetz regression tests. Separate timestamp and timestamptz regression test. --- src/backend/parser/parse_coerce.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/backend/parser/parse_coerce.c') diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index 5f769a81ea..80164f86b3 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.60 2001/06/24 02:41:21 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.61 2001/09/28 08:09:09 thomas Exp $ * *------------------------------------------------------------------------- */ @@ -240,7 +240,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids) oid_array[0] = inputTypeId; ftup = SearchSysCache(PROCNAME, - PointerGetDatum(typeidTypeName(targetTypeId)), + PointerGetDatum(typeidTypeName(targetTypeId)), Int32GetDatum(1), PointerGetDatum(oid_array), 0); @@ -498,6 +498,7 @@ TypeCategory(Oid inType) case (TIMETZOID): case (ABSTIMEOID): case (TIMESTAMPOID): + case (TIMESTAMPTZOID): result = DATETIME_TYPE; break; @@ -577,7 +578,10 @@ PreferredType(CATEGORY category, Oid type) break; case (DATETIME_TYPE): - result = TIMESTAMPOID; + if (type == DATEOID) + result = TIMESTAMPOID; + else + result = TIMESTAMPTZOID; break; case (TIMESPAN_TYPE): @@ -634,10 +638,14 @@ PromoteTypeToNext(Oid inType) break; case (DATEOID): - case (ABSTIMEOID): result = TIMESTAMPOID; break; + case (ABSTIMEOID): + case (TIMESTAMPOID): + result = TIMESTAMPTZOID; + break; + case (TIMEOID): case (RELTIMEOID): result = INTERVALOID; @@ -646,7 +654,7 @@ PromoteTypeToNext(Oid inType) case (BOOLOID): case (TEXTOID): case (FLOAT8OID): - case (TIMESTAMPOID): + case (TIMESTAMPTZOID): case (INTERVALOID): default: result = inType; -- cgit v1.2.1