Commit 5553d657 authored by Teodor Sigaev's avatar Teodor Sigaev

In accordance to

http://www.pgsql.ru/db/mw/msg.html?mid=2045361

change TimeATD to/from Datum macros.

Re-initdb is needed.
parent 33b92a78
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.253 2004/12/31 22:03:24 pgsql Exp $ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.254 2005/02/25 16:13:29 teodor Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 200411041 #define CATALOG_VERSION_NO 200502251
#endif #endif
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/utils/date.h,v 1.29 2004/12/31 22:03:45 pgsql Exp $ * $PostgreSQL: pgsql/src/include/utils/date.h,v 1.30 2005/02/25 16:13:29 teodor Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -38,18 +38,28 @@ typedef struct ...@@ -38,18 +38,28 @@ typedef struct
int32 zone; /* numeric time zone, in seconds */ int32 zone; /* numeric time zone, in seconds */
} TimeTzADT; } TimeTzADT;
/*
* Macros for fmgr-callable functions.
*
* For TimeADT, we make use of the same support routines as for float8 or int64.
* Therefore TimeADT is pass-by-reference if and only if float8 or int64 is!
*/
#ifdef HAVE_INT64_TIMESTAMP #ifdef HAVE_INT64_TIMESTAMP
#define MAX_TIME_PRECISION 6 #define MAX_TIME_PRECISION 6
#define DatumGetDateADT(X) ((DateADT) DatumGetInt32(X))
#define DatumGetTimeADT(X) ((TimeADT) DatumGetInt64(X))
#define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X))
#define DateADTGetDatum(X) Int32GetDatum(X)
#define TimeADTGetDatum(X) Int64GetDatum(X)
#define TimeTzADTPGetDatum(X) PointerGetDatum(X)
#else #else
#define MAX_TIME_PRECISION 10 #define MAX_TIME_PRECISION 10
#endif
/*
* Macros for fmgr-callable functions.
*
* For TimeADT, we make use of the same support routines as for float8.
* Therefore TimeADT is pass-by-reference if and only if float8 is!
*/
#define DatumGetDateADT(X) ((DateADT) DatumGetInt32(X)) #define DatumGetDateADT(X) ((DateADT) DatumGetInt32(X))
#define DatumGetTimeADT(X) ((TimeADT) DatumGetFloat8(X)) #define DatumGetTimeADT(X) ((TimeADT) DatumGetFloat8(X))
#define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X)) #define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X))
...@@ -58,6 +68,8 @@ typedef struct ...@@ -58,6 +68,8 @@ typedef struct
#define TimeADTGetDatum(X) Float8GetDatum(X) #define TimeADTGetDatum(X) Float8GetDatum(X)
#define TimeTzADTPGetDatum(X) PointerGetDatum(X) #define TimeTzADTPGetDatum(X) PointerGetDatum(X)
#endif /* HAVE_INT64_TIMESTAMP */
#define PG_GETARG_DATEADT(n) DatumGetDateADT(PG_GETARG_DATUM(n)) #define PG_GETARG_DATEADT(n) DatumGetDateADT(PG_GETARG_DATUM(n))
#define PG_GETARG_TIMEADT(n) DatumGetTimeADT(PG_GETARG_DATUM(n)) #define PG_GETARG_TIMEADT(n) DatumGetTimeADT(PG_GETARG_DATUM(n))
#define PG_GETARG_TIMETZADT_P(n) DatumGetTimeTzADTP(PG_GETARG_DATUM(n)) #define PG_GETARG_TIMETZADT_P(n) DatumGetTimeTzADTP(PG_GETARG_DATUM(n))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment