mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +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:
		@@ -311,7 +311,6 @@ check_hash_func_signature(Oid funcid, int16 amprocnum, Oid argtype)
 | 
			
		||||
		 */
 | 
			
		||||
		if ((funcid == F_HASHINT4 || funcid == F_HASHINT4EXTENDED) &&
 | 
			
		||||
			(argtype == DATEOID ||
 | 
			
		||||
			 argtype == ABSTIMEOID || argtype == RELTIMEOID ||
 | 
			
		||||
			 argtype == XIDOID || argtype == CIDOID))
 | 
			
		||||
			 /* okay, allowed use of hashint4() */ ;
 | 
			
		||||
		else if ((funcid == F_TIMESTAMP_HASH ||
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ CREATE VIEW pg_shadow AS
 | 
			
		||||
        rolreplication AS userepl,
 | 
			
		||||
        rolbypassrls AS usebypassrls,
 | 
			
		||||
        rolpassword AS passwd,
 | 
			
		||||
        rolvaliduntil::abstime AS valuntil,
 | 
			
		||||
        rolvaliduntil AS valuntil,
 | 
			
		||||
        setconfig AS useconfig
 | 
			
		||||
    FROM pg_authid LEFT JOIN pg_db_role_setting s
 | 
			
		||||
    ON (pg_authid.oid = setrole AND setdatabase = 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ OBJS = acl.o amutils.o arrayfuncs.o array_expanded.o array_selfuncs.o \
 | 
			
		||||
	float.o format_type.o formatting.o genfile.o \
 | 
			
		||||
	geo_ops.o geo_selfuncs.o geo_spgist.o inet_cidr_ntop.o inet_net_pton.o \
 | 
			
		||||
	int.o int8.o json.o jsonb.o jsonb_gin.o jsonb_op.o jsonb_util.o \
 | 
			
		||||
	jsonfuncs.o like.o lockfuncs.o mac.o mac8.o misc.o nabstime.o name.o \
 | 
			
		||||
	jsonfuncs.o like.o lockfuncs.o mac.o mac8.o misc.o name.o \
 | 
			
		||||
	network.o network_gist.o network_selfuncs.o network_spgist.o \
 | 
			
		||||
	numeric.o numutils.o oid.o oracle_compat.o \
 | 
			
		||||
	orderedsetaggs.o pg_locale.o pg_lsn.o pg_upgrade_support.o \
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,6 @@
 | 
			
		||||
 *	- better number building (formatting) / parsing, now it isn't
 | 
			
		||||
 *		  ideal code
 | 
			
		||||
 *	- use Assert()
 | 
			
		||||
 *	- add support for abstime
 | 
			
		||||
 *	- add support for roman number to standard number conversion
 | 
			
		||||
 *	- add support for number spelling
 | 
			
		||||
 *	- add support for string to string formatting (we must be better
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -137,7 +137,6 @@
 | 
			
		||||
#include "utils/fmgroids.h"
 | 
			
		||||
#include "utils/index_selfuncs.h"
 | 
			
		||||
#include "utils/lsyscache.h"
 | 
			
		||||
#include "utils/nabstime.h"
 | 
			
		||||
#include "utils/pg_locale.h"
 | 
			
		||||
#include "utils/rel.h"
 | 
			
		||||
#include "utils/selfuncs.h"
 | 
			
		||||
@@ -4156,11 +4155,8 @@ convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
 | 
			
		||||
			 */
 | 
			
		||||
		case TIMESTAMPOID:
 | 
			
		||||
		case TIMESTAMPTZOID:
 | 
			
		||||
		case ABSTIMEOID:
 | 
			
		||||
		case DATEOID:
 | 
			
		||||
		case INTERVALOID:
 | 
			
		||||
		case RELTIMEOID:
 | 
			
		||||
		case TINTERVALOID:
 | 
			
		||||
		case TIMEOID:
 | 
			
		||||
		case TIMETZOID:
 | 
			
		||||
			*scaledvalue = convert_timevalue_to_scalar(value, valuetypid,
 | 
			
		||||
@@ -4583,9 +4579,6 @@ convert_timevalue_to_scalar(Datum value, Oid typid, bool *failure)
 | 
			
		||||
			return DatumGetTimestamp(value);
 | 
			
		||||
		case TIMESTAMPTZOID:
 | 
			
		||||
			return DatumGetTimestampTz(value);
 | 
			
		||||
		case ABSTIMEOID:
 | 
			
		||||
			return DatumGetTimestamp(DirectFunctionCall1(abstime_timestamp,
 | 
			
		||||
														 value));
 | 
			
		||||
		case DATEOID:
 | 
			
		||||
			return date2timestamp_no_overflow(DatumGetDateADT(value));
 | 
			
		||||
		case INTERVALOID:
 | 
			
		||||
@@ -4600,16 +4593,6 @@ convert_timevalue_to_scalar(Datum value, Oid typid, bool *failure)
 | 
			
		||||
				return interval->time + interval->day * (double) USECS_PER_DAY +
 | 
			
		||||
					interval->month * ((DAYS_PER_YEAR / (double) MONTHS_PER_YEAR) * USECS_PER_DAY);
 | 
			
		||||
			}
 | 
			
		||||
		case RELTIMEOID:
 | 
			
		||||
			return (DatumGetRelativeTime(value) * 1000000.0);
 | 
			
		||||
		case TINTERVALOID:
 | 
			
		||||
			{
 | 
			
		||||
				TimeInterval tinterval = DatumGetTimeInterval(value);
 | 
			
		||||
 | 
			
		||||
				if (tinterval->status != 0)
 | 
			
		||||
					return ((tinterval->data[1] - tinterval->data[0]) * 1000000.0);
 | 
			
		||||
				return 0;		/* for lack of a better idea */
 | 
			
		||||
			}
 | 
			
		||||
		case TIMEOID:
 | 
			
		||||
			return DatumGetTimeADT(value);
 | 
			
		||||
		case TIMETZOID:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user