mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Implement "date/time grand unification".
Transform datetime and timespan into timestamp and interval.
Deprecate datetime and timespan, though translate to new types in gram.y.
Transform all datetime and timespan catalog entries into new types.
Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
routines for all date/time types.
date.{h,c} now deals with date, time types.
timestamp.{h,c} now deals with timestamp, interval types.
nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: parse_coerce.h,v 1.17 2000/01/26 05:58:27 momjian Exp $
|
||||
* $Id: parse_coerce.h,v 1.18 2000/02/16 17:26:16 thomas Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -48,8 +48,9 @@ typedef enum CATEGORY
|
||||
|| ((t) == INT4OID) \
|
||||
|| ((t) == INT8OID) \
|
||||
|| ((t) == FLOAT8OID) \
|
||||
|| ((t) == DATETIMEOID) \
|
||||
|| ((t) == NUMERICOID) \
|
||||
|| ((t) == TIMESTAMPOID) \
|
||||
|| ((t) == INTERVALOID) \
|
||||
|| ((t) == ABSTIMEOID) \
|
||||
|| ((t) == RELTIMEOID) \
|
||||
|| ((t) == CHAROID) \
|
||||
@@ -70,8 +71,8 @@ typedef enum CATEGORY
|
||||
* Check for types with the same underlying binary representation.
|
||||
* This allows us to cheat and directly exchange values without
|
||||
* going through the trouble of calling a conversion function.
|
||||
* Remove equivalencing of FLOAT8 and DATETIME. They really are not
|
||||
* close enough in behavior, with the DATETIME reserved values
|
||||
* Remove equivalencing of FLOAT8 and TIMESTAMP. They really are not
|
||||
* close enough in behavior, with the TIMESTAMP reserved values
|
||||
* and special formatting. - thomas 1999-01-24
|
||||
*/
|
||||
#define IS_BINARY_COMPATIBLE(a,b) \
|
||||
@@ -87,12 +88,8 @@ typedef enum CATEGORY
|
||||
|| ((a) == INT4OID && (b) == REGPROCOID) \
|
||||
|| ((a) == REGPROCOID && (b) == OIDOID) \
|
||||
|| ((a) == REGPROCOID && (b) == INT4OID) \
|
||||
|| ((a) == ABSTIMEOID && (b) == TIMESTAMPOID) \
|
||||
|| ((a) == ABSTIMEOID && (b) == INT4OID) \
|
||||
|| ((a) == TIMESTAMPOID && (b) == ABSTIMEOID) \
|
||||
|| ((a) == TIMESTAMPOID && (b) == INT4OID) \
|
||||
|| ((a) == INT4OID && (b) == ABSTIMEOID) \
|
||||
|| ((a) == INT4OID && (b) == TIMESTAMPOID) \
|
||||
|| ((a) == RELTIMEOID && (b) == INT4OID) \
|
||||
|| ((a) == INT4OID && (b) == RELTIMEOID) \
|
||||
|| ((a) == INETOID && (b) == CIDROID) \
|
||||
@@ -104,21 +101,21 @@ typedef enum CATEGORY
|
||||
#define IS_HIGHER_TYPE(t) \
|
||||
(((t) == TEXTOID) \
|
||||
|| ((t) == FLOAT8OID) \
|
||||
|| ((t) == TIMESPANOID) \
|
||||
|| ((t) == DATETIMEOID) \
|
||||
|| ((t) == INTERVALOID) \
|
||||
|| ((t) == TIMESTAMPOID) \
|
||||
|| ((t) == POLYGONOID) \
|
||||
|| ((t) == INETOID) )
|
||||
|
||||
/* IS_HIGHEST_TYPE()
|
||||
* These types are the most general in each of the type categories.
|
||||
* Since timespan and datetime overload so many functions, let's
|
||||
* give datetime the preference.
|
||||
* Since interval and timestamp overload so many functions, let's
|
||||
* give timestamp the preference.
|
||||
* Since text is a generic string type let's leave it out too.
|
||||
*/
|
||||
#define IS_HIGHEST_TYPE(t) \
|
||||
(((t) == FLOAT8OID) \
|
||||
|| ((t) == DATETIMEOID) \
|
||||
|| ((t) == TIMESPANOID))
|
||||
|| ((t) == TIMESTAMPOID) \
|
||||
|| ((t) == INTERVALOID))
|
||||
|
||||
|
||||
extern bool IsPreferredType(CATEGORY category, Oid type);
|
||||
|
||||
Reference in New Issue
Block a user