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

Commit 5553d65

Browse files
committed
In accordance to
http://www.pgsql.ru/db/mw/msg.html?mid=2045361 change TimeATD to/from Datum macros. Re-initdb is needed.
1 parent 33b92a7 commit 5553d65

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.253 2004/12/31 22:03:24 pgsql Exp $
40+
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.254 2005/02/25 16:13:29 teodor Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 200411041
56+
#define CATALOG_VERSION_NO 200502251
5757

5858
#endif

src/include/utils/date.h

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/utils/date.h,v 1.29 2004/12/31 22:03:45 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/include/utils/date.h,v 1.30 2005/02/25 16:13:29 teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -38,18 +38,28 @@ typedef struct
3838
int32 zone; /* numeric time zone, in seconds */
3939
} TimeTzADT;
4040

41+
/*
42+
* Macros for fmgr-callable functions.
43+
*
44+
* For TimeADT, we make use of the same support routines as for float8 or int64.
45+
* Therefore TimeADT is pass-by-reference if and only if float8 or int64 is!
46+
*/
4147
#ifdef HAVE_INT64_TIMESTAMP
48+
4249
#define MAX_TIME_PRECISION 6
50+
51+
#define DatumGetDateADT(X) ((DateADT) DatumGetInt32(X))
52+
#define DatumGetTimeADT(X) ((TimeADT) DatumGetInt64(X))
53+
#define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X))
54+
55+
#define DateADTGetDatum(X) Int32GetDatum(X)
56+
#define TimeADTGetDatum(X) Int64GetDatum(X)
57+
#define TimeTzADTPGetDatum(X) PointerGetDatum(X)
58+
4359
#else
60+
4461
#define MAX_TIME_PRECISION 10
45-
#endif
4662

47-
/*
48-
* Macros for fmgr-callable functions.
49-
*
50-
* For TimeADT, we make use of the same support routines as for float8.
51-
* Therefore TimeADT is pass-by-reference if and only if float8 is!
52-
*/
5363
#define DatumGetDateADT(X) ((DateADT) DatumGetInt32(X))
5464
#define DatumGetTimeADT(X) ((TimeADT) DatumGetFloat8(X))
5565
#define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X))
@@ -58,6 +68,8 @@ typedef struct
5868
#define TimeADTGetDatum(X) Float8GetDatum(X)
5969
#define TimeTzADTPGetDatum(X) PointerGetDatum(X)
6070

71+
#endif /* HAVE_INT64_TIMESTAMP */
72+
6173
#define PG_GETARG_DATEADT(n) DatumGetDateADT(PG_GETARG_DATUM(n))
6274
#define PG_GETARG_TIMEADT(n) DatumGetTimeADT(PG_GETARG_DATUM(n))
6375
#define PG_GETARG_TIMETZADT_P(n) DatumGetTimeTzADTP(PG_GETARG_DATUM(n))

0 commit comments

Comments
 (0)