mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Remove deprecated abstime, reltime, tinterval datatypes.
These types have been deprecated for a *long* time.
Catversion bump, for obvious reasons.
Author: Andres Freund
Discussion:
https://postgr.es/m/20181009192237.34wjp3nmw7oynmmr@alap3.anarazel.de
https://postgr.es/m/20171213080506.cwjkpcz3bkk6yz2u@alap3.anarazel.de
https://postgr.es/m/25615.1513115237@sss.pgh.pa.us
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/date.h"
|
||||
#include "utils/datetime.h"
|
||||
#include "utils/nabstime.h"
|
||||
#include "utils/sortsupport.h"
|
||||
|
||||
/*
|
||||
@@ -1170,55 +1169,6 @@ timestamptz_date(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
|
||||
/* abstime_date()
|
||||
* Convert abstime to date data type.
|
||||
*/
|
||||
Datum
|
||||
abstime_date(PG_FUNCTION_ARGS)
|
||||
{
|
||||
AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0);
|
||||
DateADT result;
|
||||
struct pg_tm tt,
|
||||
*tm = &tt;
|
||||
int tz;
|
||||
|
||||
switch (abstime)
|
||||
{
|
||||
case INVALID_ABSTIME:
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot convert reserved abstime value to date")));
|
||||
result = 0; /* keep compiler quiet */
|
||||
break;
|
||||
|
||||
case NOSTART_ABSTIME:
|
||||
DATE_NOBEGIN(result);
|
||||
break;
|
||||
|
||||
case NOEND_ABSTIME:
|
||||
DATE_NOEND(result);
|
||||
break;
|
||||
|
||||
default:
|
||||
abstime2tm(abstime, &tz, tm, NULL);
|
||||
/* Prevent overflow in Julian-day routines */
|
||||
if (!IS_VALID_JULIAN(tm->tm_year, tm->tm_mon, tm->tm_mday))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||
errmsg("abstime out of range for date")));
|
||||
result = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - POSTGRES_EPOCH_JDATE;
|
||||
/* Now check for just-out-of-range dates */
|
||||
if (!IS_VALID_DATE(result))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||
errmsg("abstime out of range for date")));
|
||||
break;
|
||||
}
|
||||
|
||||
PG_RETURN_DATEADT(result);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Time ADT
|
||||
*****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user