From cda6a8d01d391eab45c4b3e0043a1b2b31072f5f Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Fri, 28 Sep 2018 15:21:48 -0700 Subject: [PATCH] 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 --- doc/src/sgml/brin.sgml | 22 - doc/src/sgml/catalogs.sgml | 4 +- doc/src/sgml/datatype.sgml | 8 - doc/src/sgml/xfunc.sgml | 20 - src/backend/access/hash/hashvalidate.c | 1 - src/backend/catalog/system_views.sql | 2 +- src/backend/utils/adt/Makefile | 2 +- src/backend/utils/adt/date.c | 50 - src/backend/utils/adt/formatting.c | 1 - src/backend/utils/adt/nabstime.c | 1541 -------------------- src/backend/utils/adt/selfuncs.c | 17 - src/bin/pg_dump/pg_dumpall.c | 2 +- src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_aggregate.dat | 6 - src/include/catalog/pg_amop.dat | 98 -- src/include/catalog/pg_amproc.dat | 45 - src/include/catalog/pg_cast.dat | 26 - src/include/catalog/pg_opclass.dat | 16 - src/include/catalog/pg_operator.dat | 141 -- src/include/catalog/pg_opfamily.dat | 14 - src/include/catalog/pg_proc.dat | 198 --- src/include/catalog/pg_type.dat | 15 - src/include/utils/datetime.h | 2 +- src/include/utils/nabstime.h | 103 -- src/interfaces/ecpg/ecpglib/execute.c | 6 - src/test/regress/expected/abstime.out | 136 -- src/test/regress/expected/alter_table.out | 30 +- src/test/regress/expected/horology.out | 210 --- src/test/regress/expected/opr_sanity.out | 34 +- src/test/regress/expected/reltime.out | 109 -- src/test/regress/expected/rules.out | 2 +- src/test/regress/expected/sanity_check.out | 3 - src/test/regress/expected/tinterval.out | 172 --- src/test/regress/parallel_schedule | 4 +- src/test/regress/serial_schedule | 3 - src/test/regress/sql/abstime.sql | 67 - src/test/regress/sql/alter_table.sql | 24 +- src/test/regress/sql/horology.sql | 62 - src/test/regress/sql/opr_sanity.sql | 2 - src/test/regress/sql/reltime.sql | 50 - src/test/regress/sql/tinterval.sql | 97 -- 41 files changed, 29 insertions(+), 3318 deletions(-) delete mode 100644 src/backend/utils/adt/nabstime.c delete mode 100644 src/include/utils/nabstime.h delete mode 100644 src/test/regress/expected/abstime.out delete mode 100644 src/test/regress/expected/reltime.out delete mode 100644 src/test/regress/expected/tinterval.out delete mode 100644 src/test/regress/sql/abstime.sql delete mode 100644 src/test/regress/sql/reltime.sql delete mode 100644 src/test/regress/sql/tinterval.sql diff --git a/doc/src/sgml/brin.sgml b/doc/src/sgml/brin.sgml index f47e1968a4..da0c911153 100644 --- a/doc/src/sgml/brin.sgml +++ b/doc/src/sgml/brin.sgml @@ -129,17 +129,6 @@ LOG: request for BRIN range summarization for index "brin_wi_idx" page 128 was - - abstime_minmax_ops - abstime - - < - <= - = - >= - > - - int8_minmax_ops bigint @@ -388,17 +377,6 @@ LOG: request for BRIN range summarization for index "brin_wi_idx" page 128 was > - - reltime_minmax_ops - reltime - - < - <= - = - >= - > - - int2_minmax_ops smallint diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 0179deea2e..6d6fbecd12 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -10646,7 +10646,7 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx valuntil - abstime + timestamptz Password expiry time (only used for password authentication) @@ -11125,7 +11125,7 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx valuntil - abstime + timestamptz Password expiry time (only used for password authentication) diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index f9458c9921..8c38dde8fb 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -1711,14 +1711,6 @@ MINUTE TO SECOND any application. - - The types abstime - and reltime are lower precision types which are used internally. - You are discouraged from using these types in - applications; these internal types - might disappear in a future release. - - Date/Time Input diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 1a74d93173..e18272c33a 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -2069,16 +2069,6 @@ memcpy(destination->data, buffer, 40); - - abstime - AbsoluteTime - utils/nabstime.h - - - bigint (int8) - int64 - postgres.h - boolean bool @@ -2179,11 +2169,6 @@ memcpy(destination->data, buffer, 40); regproc postgres.h - - reltime - RelativeTime - utils/nabstime.h - text text* @@ -2209,11 +2194,6 @@ memcpy(destination->data, buffer, 40); Timestamp* datatype/timestamp.h - - tinterval - TimeInterval - utils/nabstime.h - varchar VarChar* diff --git a/src/backend/access/hash/hashvalidate.c b/src/backend/access/hash/hashvalidate.c index aac148fd35..390a6ea1e0 100644 --- a/src/backend/access/hash/hashvalidate.c +++ b/src/backend/access/hash/hashvalidate.c @@ -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 || diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index 0c1bcebb0d..a03b005f73 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -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) diff --git a/src/backend/utils/adt/Makefile b/src/backend/utils/adt/Makefile index 4b35dbb8bb..746c7ae844 100644 --- a/src/backend/utils/adt/Makefile +++ b/src/backend/utils/adt/Makefile @@ -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 \ diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index 87146a2161..cb6b5e55bf 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -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 *****************************************************************************/ diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 5d472d0113..b3ff133027 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -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 diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c deleted file mode 100644 index 2c8e7ad055..0000000000 --- a/src/backend/utils/adt/nabstime.c +++ /dev/null @@ -1,1541 +0,0 @@ -/*------------------------------------------------------------------------- - * - * nabstime.c - * Utilities for the built-in type "AbsoluteTime". - * Functions for the built-in type "RelativeTime". - * Functions for the built-in type "TimeInterval". - * - * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * - * IDENTIFICATION - * src/backend/utils/adt/nabstime.c - * - *------------------------------------------------------------------------- - */ -#include "postgres.h" - -#include -#include -#include -#include -#include - -#include "libpq/pqformat.h" -#include "miscadmin.h" -#include "utils/builtins.h" -#include "utils/datetime.h" -#include "utils/nabstime.h" - -#define MIN_DAYNUM (-24856) /* December 13, 1901 */ -#define MAX_DAYNUM 24854 /* January 18, 2038 */ - -/* - * Unix epoch is Jan 1 00:00:00 1970. - * Postgres knows about times sixty-eight years on either side of that - * for these 4-byte types. - * - * "tinterval" is two 4-byte fields. - * Definitions for parsing tinterval. - */ - -#define IsSpace(C) ((C) == ' ') - -#define T_INTERVAL_INVAL 0 /* data represents no valid tinterval */ -#define T_INTERVAL_VALID 1 /* data represents a valid tinterval */ -/* - * ['Mon May 10 23:59:12 1943 PST' 'Sun Jan 14 03:14:21 1973 PST'] - * 0 1 2 3 4 5 6 - * 1234567890123456789012345678901234567890123456789012345678901234 - * - * we allocate some extra -- timezones are usually 3 characters but - * this is not in the POSIX standard... - */ -#define T_INTERVAL_LEN 80 -#define INVALID_INTERVAL_STR "Undefined Range" -#define INVALID_INTERVAL_STR_LEN (sizeof(INVALID_INTERVAL_STR)-1) - -#define ABSTIMEMIN(t1, t2) \ - (DatumGetBool(DirectFunctionCall2(abstimele, \ - AbsoluteTimeGetDatum(t1), \ - AbsoluteTimeGetDatum(t2))) ? (t1) : (t2)) -#define ABSTIMEMAX(t1, t2) \ - (DatumGetBool(DirectFunctionCall2(abstimelt, \ - AbsoluteTimeGetDatum(t1), \ - AbsoluteTimeGetDatum(t2))) ? (t2) : (t1)) - - -/* - * Function prototypes -- internal to this file only - */ - -static AbsoluteTime tm2abstime(struct pg_tm *tm, int tz); -static void reltime2tm(RelativeTime time, struct pg_tm *tm); -static void parsetinterval(char *i_string, - AbsoluteTime *i_start, - AbsoluteTime *i_end); - - -/* - * GetCurrentAbsoluteTime() - * - * Get the current system time (relative to Unix epoch). - * - * NB: this will overflow in 2038; it should be gone long before that. - */ -AbsoluteTime -GetCurrentAbsoluteTime(void) -{ - time_t now; - - now = time(NULL); - return (AbsoluteTime) now; -} - - -void -abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm *tm, char **tzn) -{ - pg_time_t time = (pg_time_t) _time; - struct pg_tm *tx; - - if (tzp != NULL) - tx = pg_localtime(&time, session_timezone); - else - tx = pg_gmtime(&time); - - tm->tm_year = tx->tm_year + 1900; - tm->tm_mon = tx->tm_mon + 1; - tm->tm_mday = tx->tm_mday; - tm->tm_hour = tx->tm_hour; - tm->tm_min = tx->tm_min; - tm->tm_sec = tx->tm_sec; - tm->tm_isdst = tx->tm_isdst; - - tm->tm_gmtoff = tx->tm_gmtoff; - tm->tm_zone = tx->tm_zone; - - if (tzp != NULL) - { - *tzp = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */ - - /* - * XXX FreeBSD man pages indicate that this should work - tgl 97/04/23 - */ - if (tzn != NULL) - { - /* - * Copy no more than MAXTZLEN bytes of timezone to tzn, in case it - * contains an error message, which doesn't fit in the buffer - */ - StrNCpy(*tzn, tm->tm_zone, MAXTZLEN + 1); - if (strlen(tm->tm_zone) > MAXTZLEN) - ereport(WARNING, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid time zone name: \"%s\"", - tm->tm_zone))); - } - } - else - tm->tm_isdst = -1; -} - - -/* tm2abstime() - * Convert a tm structure to abstime. - * Note that tm has full year (not 1900-based) and 1-based month. - */ -static AbsoluteTime -tm2abstime(struct pg_tm *tm, int tz) -{ - int day; - AbsoluteTime sec; - - /* validate, before going out of range on some members */ - if (tm->tm_year < 1901 || tm->tm_year > 2038 || - tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR || - tm->tm_mday < 1 || tm->tm_mday > 31 || - tm->tm_hour < 0 || - tm->tm_hour > HOURS_PER_DAY || /* test for > 24:00:00 */ - (tm->tm_hour == HOURS_PER_DAY && (tm->tm_min > 0 || tm->tm_sec > 0)) || - tm->tm_min < 0 || tm->tm_min > MINS_PER_HOUR - 1 || - tm->tm_sec < 0 || tm->tm_sec > SECS_PER_MINUTE) - return INVALID_ABSTIME; - - day = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - UNIX_EPOCH_JDATE; - - /* check for time out of range */ - if (day < MIN_DAYNUM || day > MAX_DAYNUM) - return INVALID_ABSTIME; - - /* convert to seconds */ - sec = tm->tm_sec + tz + (tm->tm_min + (day * HOURS_PER_DAY + tm->tm_hour) * MINS_PER_HOUR) * SECS_PER_MINUTE; - - /* - * check for overflow. We need a little slop here because the H/M/S plus - * TZ offset could add up to more than 1 day. - */ - if ((day >= MAX_DAYNUM - 10 && sec < 0) || - (day <= MIN_DAYNUM + 10 && sec > 0)) - return INVALID_ABSTIME; - - /* check for reserved values (e.g. "current" on edge of usual range */ - if (!AbsoluteTimeIsReal(sec)) - return INVALID_ABSTIME; - - return sec; -} - - -/* abstimein() - * Decode date/time string and return abstime. - */ -Datum -abstimein(PG_FUNCTION_ARGS) -{ - char *str = PG_GETARG_CSTRING(0); - AbsoluteTime result; - fsec_t fsec; - int tz = 0; - struct pg_tm date, - *tm = &date; - int dterr; - char *field[MAXDATEFIELDS]; - char workbuf[MAXDATELEN + 1]; - int dtype; - int nf, - ftype[MAXDATEFIELDS]; - - dterr = ParseDateTime(str, workbuf, sizeof(workbuf), - field, ftype, MAXDATEFIELDS, &nf); - if (dterr == 0) - dterr = DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz); - if (dterr != 0) - DateTimeParseError(dterr, str, "abstime"); - - switch (dtype) - { - case DTK_DATE: - result = tm2abstime(tm, tz); - break; - - case DTK_EPOCH: - - /* - * Don't bother retaining this as a reserved value, but instead - * just set to the actual epoch time (1970-01-01) - */ - result = 0; - break; - - case DTK_LATE: - result = NOEND_ABSTIME; - break; - - case DTK_EARLY: - result = NOSTART_ABSTIME; - break; - - case DTK_INVALID: - result = INVALID_ABSTIME; - break; - - default: - elog(ERROR, "unexpected dtype %d while parsing abstime \"%s\"", - dtype, str); - result = INVALID_ABSTIME; - break; - }; - - PG_RETURN_ABSOLUTETIME(result); -} - - -/* abstimeout() - * Given an AbsoluteTime return the English text version of the date - */ -Datum -abstimeout(PG_FUNCTION_ARGS) -{ - AbsoluteTime time = PG_GETARG_ABSOLUTETIME(0); - char *result; - int tz; - double fsec = 0; - struct pg_tm tt, - *tm = &tt; - char buf[MAXDATELEN + 1]; - char zone[MAXDATELEN + 1], - *tzn = zone; - - switch (time) - { - /* - * Note that timestamp no longer supports 'invalid'. Retain - * 'invalid' for abstime for now, but dump it someday. - */ - case INVALID_ABSTIME: - strcpy(buf, INVALID); - break; - case NOEND_ABSTIME: - strcpy(buf, LATE); - break; - case NOSTART_ABSTIME: - strcpy(buf, EARLY); - break; - default: - abstime2tm(time, &tz, tm, &tzn); - EncodeDateTime(tm, fsec, true, tz, tzn, DateStyle, buf); - break; - } - - result = pstrdup(buf); - PG_RETURN_CSTRING(result); -} - -/* - * abstimerecv - converts external binary format to abstime - */ -Datum -abstimerecv(PG_FUNCTION_ARGS) -{ - StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); - - PG_RETURN_ABSOLUTETIME((AbsoluteTime) pq_getmsgint(buf, sizeof(AbsoluteTime))); -} - -/* - * abstimesend - converts abstime to binary format - */ -Datum -abstimesend(PG_FUNCTION_ARGS) -{ - AbsoluteTime time = PG_GETARG_ABSOLUTETIME(0); - StringInfoData buf; - - pq_begintypsend(&buf); - pq_sendint32(&buf, time); - PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); -} - - -/* abstime_finite() - */ -Datum -abstime_finite(PG_FUNCTION_ARGS) -{ - AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0); - - PG_RETURN_BOOL(abstime != INVALID_ABSTIME && - abstime != NOSTART_ABSTIME && - abstime != NOEND_ABSTIME); -} - - -/* - * abstime comparison routines - */ -static int -abstime_cmp_internal(AbsoluteTime a, AbsoluteTime b) -{ - /* - * We consider all INVALIDs to be equal and larger than any non-INVALID. - * This is somewhat arbitrary; the important thing is to have a consistent - * sort order. - */ - if (a == INVALID_ABSTIME) - { - if (b == INVALID_ABSTIME) - return 0; /* INVALID = INVALID */ - else - return 1; /* INVALID > non-INVALID */ - } - - if (b == INVALID_ABSTIME) - return -1; /* non-INVALID < INVALID */ - - if (a > b) - return 1; - else if (a == b) - return 0; - else - return -1; -} - -Datum -abstimeeq(PG_FUNCTION_ARGS) -{ - AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0); - AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1); - - PG_RETURN_BOOL(abstime_cmp_internal(t1, t2) == 0); -} - -Datum -abstimene(PG_FUNCTION_ARGS) -{ - AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0); - AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1); - - PG_RETURN_BOOL(abstime_cmp_internal(t1, t2) != 0); -} - -Datum -abstimelt(PG_FUNCTION_ARGS) -{ - AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0); - AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1); - - PG_RETURN_BOOL(abstime_cmp_internal(t1, t2) < 0); -} - -Datum -abstimegt(PG_FUNCTION_ARGS) -{ - AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0); - AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1); - - PG_RETURN_BOOL(abstime_cmp_internal(t1, t2) > 0); -} - -Datum -abstimele(PG_FUNCTION_ARGS) -{ - AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0); - AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1); - - PG_RETURN_BOOL(abstime_cmp_internal(t1, t2) <= 0); -} - -Datum -abstimege(PG_FUNCTION_ARGS) -{ - AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0); - AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1); - - PG_RETURN_BOOL(abstime_cmp_internal(t1, t2) >= 0); -} - -Datum -btabstimecmp(PG_FUNCTION_ARGS) -{ - AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0); - AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1); - - PG_RETURN_INT32(abstime_cmp_internal(t1, t2)); -} - - -/* timestamp_abstime() - * Convert timestamp to abstime. - */ -Datum -timestamp_abstime(PG_FUNCTION_ARGS) -{ - Timestamp timestamp = PG_GETARG_TIMESTAMP(0); - AbsoluteTime result; - fsec_t fsec; - int tz; - struct pg_tm tt, - *tm = &tt; - - if (TIMESTAMP_IS_NOBEGIN(timestamp)) - result = NOSTART_ABSTIME; - else if (TIMESTAMP_IS_NOEND(timestamp)) - result = NOEND_ABSTIME; - else if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) == 0) - { - tz = DetermineTimeZoneOffset(tm, session_timezone); - result = tm2abstime(tm, tz); - } - else - { - ereport(ERROR, - (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("timestamp out of range"))); - result = INVALID_ABSTIME; - } - - PG_RETURN_ABSOLUTETIME(result); -} - -/* abstime_timestamp() - * Convert abstime to timestamp. - */ -Datum -abstime_timestamp(PG_FUNCTION_ARGS) -{ - AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0); - Timestamp result; - struct pg_tm tt, - *tm = &tt; - int tz; - char zone[MAXDATELEN + 1], - *tzn = zone; - - switch (abstime) - { - case INVALID_ABSTIME: - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert abstime \"invalid\" to timestamp"))); - TIMESTAMP_NOBEGIN(result); - break; - - case NOSTART_ABSTIME: - TIMESTAMP_NOBEGIN(result); - break; - - case NOEND_ABSTIME: - TIMESTAMP_NOEND(result); - break; - - default: - abstime2tm(abstime, &tz, tm, &tzn); - if (tm2timestamp(tm, 0, NULL, &result) != 0) - ereport(ERROR, - (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("timestamp out of range"))); - break; - }; - - PG_RETURN_TIMESTAMP(result); -} - - -/* timestamptz_abstime() - * Convert timestamp with time zone to abstime. - */ -Datum -timestamptz_abstime(PG_FUNCTION_ARGS) -{ - TimestampTz timestamp = PG_GETARG_TIMESTAMP(0); - AbsoluteTime result; - fsec_t fsec; - struct pg_tm tt, - *tm = &tt; - - if (TIMESTAMP_IS_NOBEGIN(timestamp)) - result = NOSTART_ABSTIME; - else if (TIMESTAMP_IS_NOEND(timestamp)) - result = NOEND_ABSTIME; - else if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) == 0) - result = tm2abstime(tm, 0); - else - { - ereport(ERROR, - (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("timestamp out of range"))); - result = INVALID_ABSTIME; - } - - PG_RETURN_ABSOLUTETIME(result); -} - -/* abstime_timestamptz() - * Convert abstime to timestamp with time zone. - */ -Datum -abstime_timestamptz(PG_FUNCTION_ARGS) -{ - AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0); - TimestampTz result; - struct pg_tm tt, - *tm = &tt; - int tz; - char zone[MAXDATELEN + 1], - *tzn = zone; - - switch (abstime) - { - case INVALID_ABSTIME: - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert abstime \"invalid\" to timestamp"))); - TIMESTAMP_NOBEGIN(result); - break; - - case NOSTART_ABSTIME: - TIMESTAMP_NOBEGIN(result); - break; - - case NOEND_ABSTIME: - TIMESTAMP_NOEND(result); - break; - - default: - abstime2tm(abstime, &tz, tm, &tzn); - if (tm2timestamp(tm, 0, &tz, &result) != 0) - ereport(ERROR, - (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("timestamp out of range"))); - break; - }; - - PG_RETURN_TIMESTAMP(result); -} - - -/***************************************************************************** - * USER I/O ROUTINES * - *****************************************************************************/ - -/* - * reltimein - converts a reltime string in an internal format - */ -Datum -reltimein(PG_FUNCTION_ARGS) -{ - char *str = PG_GETARG_CSTRING(0); - RelativeTime result; - struct pg_tm tt, - *tm = &tt; - fsec_t fsec; - int dtype; - int dterr; - char *field[MAXDATEFIELDS]; - int nf, - ftype[MAXDATEFIELDS]; - char workbuf[MAXDATELEN + 1]; - - dterr = ParseDateTime(str, workbuf, sizeof(workbuf), - field, ftype, MAXDATEFIELDS, &nf); - if (dterr == 0) - dterr = DecodeInterval(field, ftype, nf, INTERVAL_FULL_RANGE, - &dtype, tm, &fsec); - - /* if those functions think it's a bad format, try ISO8601 style */ - if (dterr == DTERR_BAD_FORMAT) - dterr = DecodeISO8601Interval(str, - &dtype, tm, &fsec); - - if (dterr != 0) - { - if (dterr == DTERR_FIELD_OVERFLOW) - dterr = DTERR_INTERVAL_OVERFLOW; - DateTimeParseError(dterr, str, "reltime"); - } - - switch (dtype) - { - case DTK_DELTA: - result = ((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec; - result += tm->tm_year * SECS_PER_YEAR + ((tm->tm_mon * DAYS_PER_MONTH) + tm->tm_mday) * SECS_PER_DAY; - break; - - default: - elog(ERROR, "unexpected dtype %d while parsing reltime \"%s\"", - dtype, str); - result = INVALID_RELTIME; - break; - } - - PG_RETURN_RELATIVETIME(result); -} - -/* - * reltimeout - converts the internal format to a reltime string - */ -Datum -reltimeout(PG_FUNCTION_ARGS) -{ - RelativeTime time = PG_GETARG_RELATIVETIME(0); - char *result; - struct pg_tm tt, - *tm = &tt; - char buf[MAXDATELEN + 1]; - - reltime2tm(time, tm); - EncodeInterval(tm, 0, IntervalStyle, buf); - - result = pstrdup(buf); - PG_RETURN_CSTRING(result); -} - -/* - * reltimerecv - converts external binary format to reltime - */ -Datum -reltimerecv(PG_FUNCTION_ARGS) -{ - StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); - - PG_RETURN_RELATIVETIME((RelativeTime) pq_getmsgint(buf, sizeof(RelativeTime))); -} - -/* - * reltimesend - converts reltime to binary format - */ -Datum -reltimesend(PG_FUNCTION_ARGS) -{ - RelativeTime time = PG_GETARG_RELATIVETIME(0); - StringInfoData buf; - - pq_begintypsend(&buf); - pq_sendint32(&buf, time); - PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); -} - - -static void -reltime2tm(RelativeTime time, struct pg_tm *tm) -{ - double dtime = time; - - FMODULO(dtime, tm->tm_year, 31557600); - FMODULO(dtime, tm->tm_mon, 2592000); - FMODULO(dtime, tm->tm_mday, SECS_PER_DAY); - FMODULO(dtime, tm->tm_hour, SECS_PER_HOUR); - FMODULO(dtime, tm->tm_min, SECS_PER_MINUTE); - FMODULO(dtime, tm->tm_sec, 1); -} - - -/* - * tintervalin - converts a tinterval string to internal format - */ -Datum -tintervalin(PG_FUNCTION_ARGS) -{ - char *tintervalstr = PG_GETARG_CSTRING(0); - TimeInterval tinterval; - AbsoluteTime i_start, - i_end, - t1, - t2; - - parsetinterval(tintervalstr, &t1, &t2); - - tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData)); - - if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME) - tinterval->status = T_INTERVAL_INVAL; /* undefined */ - else - tinterval->status = T_INTERVAL_VALID; - - i_start = ABSTIMEMIN(t1, t2); - i_end = ABSTIMEMAX(t1, t2); - tinterval->data[0] = i_start; - tinterval->data[1] = i_end; - - PG_RETURN_TIMEINTERVAL(tinterval); -} - - -/* - * tintervalout - converts an internal tinterval format to a string - */ -Datum -tintervalout(PG_FUNCTION_ARGS) -{ - TimeInterval tinterval = PG_GETARG_TIMEINTERVAL(0); - char *i_str, - *p; - - i_str = (char *) palloc(T_INTERVAL_LEN); /* ["..." "..."] */ - strcpy(i_str, "[\""); - if (tinterval->status == T_INTERVAL_INVAL) - strcat(i_str, INVALID_INTERVAL_STR); - else - { - p = DatumGetCString(DirectFunctionCall1(abstimeout, - AbsoluteTimeGetDatum(tinterval->data[0]))); - strcat(i_str, p); - pfree(p); - strcat(i_str, "\" \""); - p = DatumGetCString(DirectFunctionCall1(abstimeout, - AbsoluteTimeGetDatum(tinterval->data[1]))); - strcat(i_str, p); - pfree(p); - } - strcat(i_str, "\"]"); - PG_RETURN_CSTRING(i_str); -} - -/* - * tintervalrecv - converts external binary format to tinterval - */ -Datum -tintervalrecv(PG_FUNCTION_ARGS) -{ - StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); - TimeInterval tinterval; - int32 status; - - tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData)); - - tinterval->status = pq_getmsgint(buf, sizeof(tinterval->status)); - tinterval->data[0] = pq_getmsgint(buf, sizeof(tinterval->data[0])); - tinterval->data[1] = pq_getmsgint(buf, sizeof(tinterval->data[1])); - - if (tinterval->data[0] == INVALID_ABSTIME || - tinterval->data[1] == INVALID_ABSTIME) - status = T_INTERVAL_INVAL; /* undefined */ - else - status = T_INTERVAL_VALID; - - if (status != tinterval->status) - ereport(ERROR, - (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), - errmsg("invalid status in external \"tinterval\" value"))); - - PG_RETURN_TIMEINTERVAL(tinterval); -} - -/* - * tintervalsend - converts tinterval to binary format - */ -Datum -tintervalsend(PG_FUNCTION_ARGS) -{ - TimeInterval tinterval = PG_GETARG_TIMEINTERVAL(0); - StringInfoData buf; - - pq_begintypsend(&buf); - pq_sendint32(&buf, tinterval->status); - pq_sendint32(&buf, tinterval->data[0]); - pq_sendint32(&buf, tinterval->data[1]); - PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); -} - - -/***************************************************************************** - * PUBLIC ROUTINES * - *****************************************************************************/ - -Datum -interval_reltime(PG_FUNCTION_ARGS) -{ - Interval *interval = PG_GETARG_INTERVAL_P(0); - RelativeTime time; - int year, - month, - day; - TimeOffset span; - - year = interval->month / MONTHS_PER_YEAR; - month = interval->month % MONTHS_PER_YEAR; - day = interval->day; - - span = ((INT64CONST(365250000) * year + INT64CONST(30000000) * month + - INT64CONST(1000000) * day) * INT64CONST(86400)) + - interval->time; - span /= USECS_PER_SEC; - - if (span < INT_MIN || span > INT_MAX) - time = INVALID_RELTIME; - else - time = span; - - PG_RETURN_RELATIVETIME(time); -} - - -Datum -reltime_interval(PG_FUNCTION_ARGS) -{ - RelativeTime reltime = PG_GETARG_RELATIVETIME(0); - Interval *result; - int year, - month, - day; - - result = (Interval *) palloc(sizeof(Interval)); - - switch (reltime) - { - case INVALID_RELTIME: - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert reltime \"invalid\" to interval"))); - result->time = 0; - result->day = 0; - result->month = 0; - break; - - default: - year = reltime / SECS_PER_YEAR; - reltime -= year * SECS_PER_YEAR; - month = reltime / (DAYS_PER_MONTH * SECS_PER_DAY); - reltime -= month * (DAYS_PER_MONTH * SECS_PER_DAY); - day = reltime / SECS_PER_DAY; - reltime -= day * SECS_PER_DAY; - - result->time = (reltime * USECS_PER_SEC); - result->month = MONTHS_PER_YEAR * year + month; - result->day = day; - break; - } - - PG_RETURN_INTERVAL_P(result); -} - - -/* - * mktinterval - creates a time interval with endpoints t1 and t2 - */ -Datum -mktinterval(PG_FUNCTION_ARGS) -{ - AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0); - AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1); - AbsoluteTime tstart = ABSTIMEMIN(t1, t2); - AbsoluteTime tend = ABSTIMEMAX(t1, t2); - TimeInterval tinterval; - - tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData)); - - if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME) - tinterval->status = T_INTERVAL_INVAL; - - else - { - tinterval->status = T_INTERVAL_VALID; - tinterval->data[0] = tstart; - tinterval->data[1] = tend; - } - - PG_RETURN_TIMEINTERVAL(tinterval); -} - -/* - * timepl, timemi and abstimemi use the formula - * abstime + reltime = abstime - * so abstime - reltime = abstime - * and abstime - abstime = reltime - */ - -/* - * timepl - returns the value of (abstime t1 + reltime t2) - */ -Datum -timepl(PG_FUNCTION_ARGS) -{ - AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0); - RelativeTime t2 = PG_GETARG_RELATIVETIME(1); - - if (AbsoluteTimeIsReal(t1) && - RelativeTimeIsValid(t2) && - ((t2 > 0 && t1 < NOEND_ABSTIME - t2) || - (t2 <= 0 && t1 > NOSTART_ABSTIME - t2))) /* prevent overflow */ - PG_RETURN_ABSOLUTETIME(t1 + t2); - - PG_RETURN_ABSOLUTETIME(INVALID_ABSTIME); -} - - -/* - * timemi - returns the value of (abstime t1 - reltime t2) - */ -Datum -timemi(PG_FUNCTION_ARGS) -{ - AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0); - RelativeTime t2 = PG_GETARG_RELATIVETIME(1); - - if (AbsoluteTimeIsReal(t1) && - RelativeTimeIsValid(t2) && - ((t2 > 0 && t1 > NOSTART_ABSTIME + t2) || - (t2 <= 0 && t1 < NOEND_ABSTIME + t2))) /* prevent overflow */ - PG_RETURN_ABSOLUTETIME(t1 - t2); - - PG_RETURN_ABSOLUTETIME(INVALID_ABSTIME); -} - - -/* - * intinterval - returns true iff absolute date is in the tinterval - */ -Datum -intinterval(PG_FUNCTION_ARGS) -{ - AbsoluteTime t = PG_GETARG_ABSOLUTETIME(0); - TimeInterval tinterval = PG_GETARG_TIMEINTERVAL(1); - - if (tinterval->status == T_INTERVAL_VALID && t != INVALID_ABSTIME) - { - if (DatumGetBool(DirectFunctionCall2(abstimege, - AbsoluteTimeGetDatum(t), - AbsoluteTimeGetDatum(tinterval->data[0]))) && - DatumGetBool(DirectFunctionCall2(abstimele, - AbsoluteTimeGetDatum(t), - AbsoluteTimeGetDatum(tinterval->data[1])))) - PG_RETURN_BOOL(true); - } - PG_RETURN_BOOL(false); -} - -/* - * tintervalrel - returns relative time corresponding to tinterval - */ -Datum -tintervalrel(PG_FUNCTION_ARGS) -{ - TimeInterval tinterval = PG_GETARG_TIMEINTERVAL(0); - AbsoluteTime t1 = tinterval->data[0]; - AbsoluteTime t2 = tinterval->data[1]; - - if (tinterval->status != T_INTERVAL_VALID) - PG_RETURN_RELATIVETIME(INVALID_RELTIME); - - if (AbsoluteTimeIsReal(t1) && - AbsoluteTimeIsReal(t2)) - PG_RETURN_RELATIVETIME(t2 - t1); - - PG_RETURN_RELATIVETIME(INVALID_RELTIME); -} - - -/* - * timenow - returns time "now", internal format - * - * Now AbsoluteTime is time since Jan 1 1970 -mer 7 Feb 1992 - */ -Datum -timenow(PG_FUNCTION_ARGS) -{ - PG_RETURN_ABSOLUTETIME(GetCurrentAbsoluteTime()); -} - -/* - * reltime comparison routines - */ -static int -reltime_cmp_internal(RelativeTime a, RelativeTime b) -{ - /* - * We consider all INVALIDs to be equal and larger than any non-INVALID. - * This is somewhat arbitrary; the important thing is to have a consistent - * sort order. - */ - if (a == INVALID_RELTIME) - { - if (b == INVALID_RELTIME) - return 0; /* INVALID = INVALID */ - else - return 1; /* INVALID > non-INVALID */ - } - - if (b == INVALID_RELTIME) - return -1; /* non-INVALID < INVALID */ - - if (a > b) - return 1; - else if (a == b) - return 0; - else - return -1; -} - -Datum -reltimeeq(PG_FUNCTION_ARGS) -{ - RelativeTime t1 = PG_GETARG_RELATIVETIME(0); - RelativeTime t2 = PG_GETARG_RELATIVETIME(1); - - PG_RETURN_BOOL(reltime_cmp_internal(t1, t2) == 0); -} - -Datum -reltimene(PG_FUNCTION_ARGS) -{ - RelativeTime t1 = PG_GETARG_RELATIVETIME(0); - RelativeTime t2 = PG_GETARG_RELATIVETIME(1); - - PG_RETURN_BOOL(reltime_cmp_internal(t1, t2) != 0); -} - -Datum -reltimelt(PG_FUNCTION_ARGS) -{ - RelativeTime t1 = PG_GETARG_RELATIVETIME(0); - RelativeTime t2 = PG_GETARG_RELATIVETIME(1); - - PG_RETURN_BOOL(reltime_cmp_internal(t1, t2) < 0); -} - -Datum -reltimegt(PG_FUNCTION_ARGS) -{ - RelativeTime t1 = PG_GETARG_RELATIVETIME(0); - RelativeTime t2 = PG_GETARG_RELATIVETIME(1); - - PG_RETURN_BOOL(reltime_cmp_internal(t1, t2) > 0); -} - -Datum -reltimele(PG_FUNCTION_ARGS) -{ - RelativeTime t1 = PG_GETARG_RELATIVETIME(0); - RelativeTime t2 = PG_GETARG_RELATIVETIME(1); - - PG_RETURN_BOOL(reltime_cmp_internal(t1, t2) <= 0); -} - -Datum -reltimege(PG_FUNCTION_ARGS) -{ - RelativeTime t1 = PG_GETARG_RELATIVETIME(0); - RelativeTime t2 = PG_GETARG_RELATIVETIME(1); - - PG_RETURN_BOOL(reltime_cmp_internal(t1, t2) >= 0); -} - -Datum -btreltimecmp(PG_FUNCTION_ARGS) -{ - RelativeTime t1 = PG_GETARG_RELATIVETIME(0); - RelativeTime t2 = PG_GETARG_RELATIVETIME(1); - - PG_RETURN_INT32(reltime_cmp_internal(t1, t2)); -} - - -/* - * tintervalsame - returns true iff tinterval i1 is same as tinterval i2 - * Check begin and end time. - */ -Datum -tintervalsame(PG_FUNCTION_ARGS) -{ - TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0); - TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1); - - if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL) - PG_RETURN_BOOL(false); - - if (DatumGetBool(DirectFunctionCall2(abstimeeq, - AbsoluteTimeGetDatum(i1->data[0]), - AbsoluteTimeGetDatum(i2->data[0]))) && - DatumGetBool(DirectFunctionCall2(abstimeeq, - AbsoluteTimeGetDatum(i1->data[1]), - AbsoluteTimeGetDatum(i2->data[1])))) - PG_RETURN_BOOL(true); - PG_RETURN_BOOL(false); -} - -/* - * tinterval comparison routines - * - * Note: comparison is based only on the lengths of the tintervals, not on - * endpoint values (as long as they're not INVALID). This is pretty bogus, - * but since it's only a legacy datatype, we're not going to change it. - * - * Some other bogus things that won't be changed for compatibility reasons: - * 1. The interval length computations overflow at 2^31 seconds, causing - * intervals longer than that to sort oddly compared to those shorter. - * 2. infinity and minus infinity (NOEND_ABSTIME and NOSTART_ABSTIME) are - * just ordinary integers. Since this code doesn't handle them specially, - * it's possible for [a b] to be considered longer than [c infinity] for - * finite abstimes a, b, c. In combination with the previous point, the - * interval [-infinity infinity] is treated as being shorter than many finite - * intervals :-( - * - * If tinterval is ever reimplemented atop timestamp, it'd be good to give - * some consideration to avoiding these problems. - */ -static int -tinterval_cmp_internal(TimeInterval a, TimeInterval b) -{ - bool a_invalid; - bool b_invalid; - AbsoluteTime a_len; - AbsoluteTime b_len; - - /* - * We consider all INVALIDs to be equal and larger than any non-INVALID. - * This is somewhat arbitrary; the important thing is to have a consistent - * sort order. - */ - a_invalid = a->status == T_INTERVAL_INVAL || - a->data[0] == INVALID_ABSTIME || - a->data[1] == INVALID_ABSTIME; - b_invalid = b->status == T_INTERVAL_INVAL || - b->data[0] == INVALID_ABSTIME || - b->data[1] == INVALID_ABSTIME; - - if (a_invalid) - { - if (b_invalid) - return 0; /* INVALID = INVALID */ - else - return 1; /* INVALID > non-INVALID */ - } - - if (b_invalid) - return -1; /* non-INVALID < INVALID */ - - a_len = a->data[1] - a->data[0]; - b_len = b->data[1] - b->data[0]; - - if (a_len > b_len) - return 1; - else if (a_len == b_len) - return 0; - else - return -1; -} - -Datum -tintervaleq(PG_FUNCTION_ARGS) -{ - TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0); - TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1); - - PG_RETURN_BOOL(tinterval_cmp_internal(i1, i2) == 0); -} - -Datum -tintervalne(PG_FUNCTION_ARGS) -{ - TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0); - TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1); - - PG_RETURN_BOOL(tinterval_cmp_internal(i1, i2) != 0); -} - -Datum -tintervallt(PG_FUNCTION_ARGS) -{ - TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0); - TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1); - - PG_RETURN_BOOL(tinterval_cmp_internal(i1, i2) < 0); -} - -Datum -tintervalle(PG_FUNCTION_ARGS) -{ - TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0); - TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1); - - PG_RETURN_BOOL(tinterval_cmp_internal(i1, i2) <= 0); -} - -Datum -tintervalgt(PG_FUNCTION_ARGS) -{ - TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0); - TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1); - - PG_RETURN_BOOL(tinterval_cmp_internal(i1, i2) > 0); -} - -Datum -tintervalge(PG_FUNCTION_ARGS) -{ - TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0); - TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1); - - PG_RETURN_BOOL(tinterval_cmp_internal(i1, i2) >= 0); -} - -Datum -bttintervalcmp(PG_FUNCTION_ARGS) -{ - TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0); - TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1); - - PG_RETURN_INT32(tinterval_cmp_internal(i1, i2)); -} - - -/* - * tintervalleneq - returns true iff length of tinterval i is equal to - * reltime t - * tintervallenne - returns true iff length of tinterval i is not equal - * to reltime t - * tintervallenlt - returns true iff length of tinterval i is less than - * reltime t - * tintervallengt - returns true iff length of tinterval i is greater - * than reltime t - * tintervallenle - returns true iff length of tinterval i is less or - * equal than reltime t - * tintervallenge - returns true iff length of tinterval i is greater or - * equal than reltime t - */ -Datum -tintervalleneq(PG_FUNCTION_ARGS) -{ - TimeInterval i = PG_GETARG_TIMEINTERVAL(0); - RelativeTime t = PG_GETARG_RELATIVETIME(1); - RelativeTime rt; - - if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME) - PG_RETURN_BOOL(false); - rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel, - TimeIntervalGetDatum(i))); - PG_RETURN_BOOL(rt != INVALID_RELTIME && rt == t); -} - -Datum -tintervallenne(PG_FUNCTION_ARGS) -{ - TimeInterval i = PG_GETARG_TIMEINTERVAL(0); - RelativeTime t = PG_GETARG_RELATIVETIME(1); - RelativeTime rt; - - if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME) - PG_RETURN_BOOL(false); - rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel, - TimeIntervalGetDatum(i))); - PG_RETURN_BOOL(rt != INVALID_RELTIME && rt != t); -} - -Datum -tintervallenlt(PG_FUNCTION_ARGS) -{ - TimeInterval i = PG_GETARG_TIMEINTERVAL(0); - RelativeTime t = PG_GETARG_RELATIVETIME(1); - RelativeTime rt; - - if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME) - PG_RETURN_BOOL(false); - rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel, - TimeIntervalGetDatum(i))); - PG_RETURN_BOOL(rt != INVALID_RELTIME && rt < t); -} - -Datum -tintervallengt(PG_FUNCTION_ARGS) -{ - TimeInterval i = PG_GETARG_TIMEINTERVAL(0); - RelativeTime t = PG_GETARG_RELATIVETIME(1); - RelativeTime rt; - - if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME) - PG_RETURN_BOOL(false); - rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel, - TimeIntervalGetDatum(i))); - PG_RETURN_BOOL(rt != INVALID_RELTIME && rt > t); -} - -Datum -tintervallenle(PG_FUNCTION_ARGS) -{ - TimeInterval i = PG_GETARG_TIMEINTERVAL(0); - RelativeTime t = PG_GETARG_RELATIVETIME(1); - RelativeTime rt; - - if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME) - PG_RETURN_BOOL(false); - rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel, - TimeIntervalGetDatum(i))); - PG_RETURN_BOOL(rt != INVALID_RELTIME && rt <= t); -} - -Datum -tintervallenge(PG_FUNCTION_ARGS) -{ - TimeInterval i = PG_GETARG_TIMEINTERVAL(0); - RelativeTime t = PG_GETARG_RELATIVETIME(1); - RelativeTime rt; - - if (i->status == T_INTERVAL_INVAL || t == INVALID_RELTIME) - PG_RETURN_BOOL(false); - rt = DatumGetRelativeTime(DirectFunctionCall1(tintervalrel, - TimeIntervalGetDatum(i))); - PG_RETURN_BOOL(rt != INVALID_RELTIME && rt >= t); -} - -/* - * tintervalct - returns true iff tinterval i1 contains tinterval i2 - */ -Datum -tintervalct(PG_FUNCTION_ARGS) -{ - TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0); - TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1); - - if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL) - PG_RETURN_BOOL(false); - if (DatumGetBool(DirectFunctionCall2(abstimele, - AbsoluteTimeGetDatum(i1->data[0]), - AbsoluteTimeGetDatum(i2->data[0]))) && - DatumGetBool(DirectFunctionCall2(abstimege, - AbsoluteTimeGetDatum(i1->data[1]), - AbsoluteTimeGetDatum(i2->data[1])))) - PG_RETURN_BOOL(true); - PG_RETURN_BOOL(false); -} - -/* - * tintervalov - returns true iff tinterval i1 (partially) overlaps i2 - */ -Datum -tintervalov(PG_FUNCTION_ARGS) -{ - TimeInterval i1 = PG_GETARG_TIMEINTERVAL(0); - TimeInterval i2 = PG_GETARG_TIMEINTERVAL(1); - - if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL) - PG_RETURN_BOOL(false); - if (DatumGetBool(DirectFunctionCall2(abstimelt, - AbsoluteTimeGetDatum(i1->data[1]), - AbsoluteTimeGetDatum(i2->data[0]))) || - DatumGetBool(DirectFunctionCall2(abstimegt, - AbsoluteTimeGetDatum(i1->data[0]), - AbsoluteTimeGetDatum(i2->data[1])))) - PG_RETURN_BOOL(false); - PG_RETURN_BOOL(true); -} - -/* - * tintervalstart - returns the start of tinterval i - */ -Datum -tintervalstart(PG_FUNCTION_ARGS) -{ - TimeInterval i = PG_GETARG_TIMEINTERVAL(0); - - if (i->status == T_INTERVAL_INVAL) - PG_RETURN_ABSOLUTETIME(INVALID_ABSTIME); - PG_RETURN_ABSOLUTETIME(i->data[0]); -} - -/* - * tintervalend - returns the end of tinterval i - */ -Datum -tintervalend(PG_FUNCTION_ARGS) -{ - TimeInterval i = PG_GETARG_TIMEINTERVAL(0); - - if (i->status == T_INTERVAL_INVAL) - PG_RETURN_ABSOLUTETIME(INVALID_ABSTIME); - PG_RETURN_ABSOLUTETIME(i->data[1]); -} - - -/***************************************************************************** - * PRIVATE ROUTINES * - *****************************************************************************/ - -/* - * parsetinterval -- parse a tinterval string - * - * output parameters: - * i_start, i_end: tinterval margins - * - * Time interval: - * `[' {` '} `'' `'' {` '} `'' `'' {` '} `]' - * - * OR `Undefined Range' (see also INVALID_INTERVAL_STR) - * - * where satisfies the syntax of absolute time. - * - * e.g. [ ' Jan 18 1902' 'Jan 1 00:00:00 1970'] - */ -static void -parsetinterval(char *i_string, - AbsoluteTime *i_start, - AbsoluteTime *i_end) -{ - char *p, - *p1; - char c; - - p = i_string; - /* skip leading blanks up to '[' */ - while ((c = *p) != '\0') - { - if (IsSpace(c)) - p++; - else if (c != '[') - goto bogus; /* syntax error */ - else - break; - } - if (c == '\0') - goto bogus; /* syntax error */ - p++; - /* skip leading blanks up to '"' */ - while ((c = *p) != '\0') - { - if (IsSpace(c)) - p++; - else if (c != '"') - goto bogus; /* syntax error */ - else - break; - } - if (c == '\0') - goto bogus; /* syntax error */ - p++; - if (strncmp(INVALID_INTERVAL_STR, p, strlen(INVALID_INTERVAL_STR)) == 0) - goto bogus; /* undefined range, handled like a syntax err. */ - /* search for the end of the first date and change it to a \0 */ - p1 = p; - while ((c = *p1) != '\0') - { - if (c == '"') - break; - p1++; - } - if (c == '\0') - goto bogus; /* syntax error */ - *p1 = '\0'; - /* get the first date */ - *i_start = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein, - CStringGetDatum(p))); - /* undo change to \0 */ - *p1 = c; - p = ++p1; - /* skip blanks up to '"', beginning of second date */ - while ((c = *p) != '\0') - { - if (IsSpace(c)) - p++; - else if (c != '"') - goto bogus; /* syntax error */ - else - break; - } - if (c == '\0') - goto bogus; /* syntax error */ - p++; - /* search for the end of the second date and change it to a \0 */ - p1 = p; - while ((c = *p1) != '\0') - { - if (c == '"') - break; - p1++; - } - if (c == '\0') - goto bogus; /* syntax error */ - *p1 = '\0'; - /* get the second date */ - *i_end = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein, - CStringGetDatum(p))); - /* undo change to \0 */ - *p1 = c; - p = ++p1; - /* skip blanks up to ']' */ - while ((c = *p) != '\0') - { - if (IsSpace(c)) - p++; - else if (c != ']') - goto bogus; /* syntax error */ - else - break; - } - if (c == '\0') - goto bogus; /* syntax error */ - p++; - c = *p; - if (c != '\0') - goto bogus; /* syntax error */ - - /* it seems to be a valid tinterval */ - return; - -bogus: - ereport(ERROR, - (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("invalid input syntax for type %s: \"%s\"", - "tinterval", i_string))); - *i_start = *i_end = INVALID_ABSTIME; /* keep compiler quiet */ -} diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index b8c0e034ca..e0ece74bb9 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -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: diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index eb29d318a4..5176626476 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -806,7 +806,7 @@ dumpRoles(PGconn *conn) "false as rolcanlogin, " "-1 as rolconnlimit, " "null::text as rolpassword, " - "null::abstime as rolvaliduntil, " + "null::timestamptz as rolvaliduntil, " "false as rolreplication, " "false as rolbypassrls, " "null as rolcomment, " diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index a8e7d4b34e..e04eabf683 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201810091 +#define CATALOG_VERSION_NO 201810111 #endif diff --git a/src/include/catalog/pg_aggregate.dat b/src/include/catalog/pg_aggregate.dat index d2a4298569..b4ce0aabf9 100644 --- a/src/include/catalog/pg_aggregate.dat +++ b/src/include/catalog/pg_aggregate.dat @@ -104,9 +104,6 @@ { aggfnoid => 'max(float8)', aggtransfn => 'float8larger', aggcombinefn => 'float8larger', aggsortop => '>(float8,float8)', aggtranstype => 'float8' }, -{ aggfnoid => 'max(abstime)', aggtransfn => 'int4larger', - aggcombinefn => 'int4larger', aggsortop => '>(abstime,abstime)', - aggtranstype => 'abstime' }, { aggfnoid => 'max(date)', aggtransfn => 'date_larger', aggcombinefn => 'date_larger', aggsortop => '>(date,date)', aggtranstype => 'date' }, @@ -169,9 +166,6 @@ { aggfnoid => 'min(float8)', aggtransfn => 'float8smaller', aggcombinefn => 'float8smaller', aggsortop => '<(float8,float8)', aggtranstype => 'float8' }, -{ aggfnoid => 'min(abstime)', aggtransfn => 'int4smaller', - aggcombinefn => 'int4smaller', aggsortop => '<(abstime,abstime)', - aggtranstype => 'abstime' }, { aggfnoid => 'min(date)', aggtransfn => 'date_smaller', aggcombinefn => 'date_smaller', aggsortop => '<(date,date)', aggtranstype => 'date' }, diff --git a/src/include/catalog/pg_amop.dat b/src/include/catalog/pg_amop.dat index a1e57d75fa..075a54c4ac 100644 --- a/src/include/catalog/pg_amop.dat +++ b/src/include/catalog/pg_amop.dat @@ -371,24 +371,6 @@ amoprighttype => 'bytea', amopstrategy => '5', amopopr => '>(bytea,bytea)', amopmethod => 'btree' }, -# btree abstime_ops - -{ amopfamily => 'btree/abstime_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '1', - amopopr => '<(abstime,abstime)', amopmethod => 'btree' }, -{ amopfamily => 'btree/abstime_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '2', - amopopr => '<=(abstime,abstime)', amopmethod => 'btree' }, -{ amopfamily => 'btree/abstime_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '3', - amopopr => '=(abstime,abstime)', amopmethod => 'btree' }, -{ amopfamily => 'btree/abstime_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '4', - amopopr => '>=(abstime,abstime)', amopmethod => 'btree' }, -{ amopfamily => 'btree/abstime_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '5', - amopopr => '>(abstime,abstime)', amopmethod => 'btree' }, - # btree datetime_ops # default operators date @@ -773,42 +755,6 @@ amoprighttype => 'money', amopstrategy => '5', amopopr => '>(money,money)', amopmethod => 'btree' }, -# btree reltime_ops - -{ amopfamily => 'btree/reltime_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '1', - amopopr => '<(reltime,reltime)', amopmethod => 'btree' }, -{ amopfamily => 'btree/reltime_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '2', - amopopr => '<=(reltime,reltime)', amopmethod => 'btree' }, -{ amopfamily => 'btree/reltime_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '3', - amopopr => '=(reltime,reltime)', amopmethod => 'btree' }, -{ amopfamily => 'btree/reltime_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '4', - amopopr => '>=(reltime,reltime)', amopmethod => 'btree' }, -{ amopfamily => 'btree/reltime_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '5', - amopopr => '>(reltime,reltime)', amopmethod => 'btree' }, - -# btree tinterval_ops - -{ amopfamily => 'btree/tinterval_ops', amoplefttype => 'tinterval', - amoprighttype => 'tinterval', amopstrategy => '1', - amopopr => '<(tinterval,tinterval)', amopmethod => 'btree' }, -{ amopfamily => 'btree/tinterval_ops', amoplefttype => 'tinterval', - amoprighttype => 'tinterval', amopstrategy => '2', - amopopr => '<=(tinterval,tinterval)', amopmethod => 'btree' }, -{ amopfamily => 'btree/tinterval_ops', amoplefttype => 'tinterval', - amoprighttype => 'tinterval', amopstrategy => '3', - amopopr => '=(tinterval,tinterval)', amopmethod => 'btree' }, -{ amopfamily => 'btree/tinterval_ops', amoplefttype => 'tinterval', - amoprighttype => 'tinterval', amopstrategy => '4', - amopopr => '>=(tinterval,tinterval)', amopmethod => 'btree' }, -{ amopfamily => 'btree/tinterval_ops', amoplefttype => 'tinterval', - amoprighttype => 'tinterval', amopstrategy => '5', - amopopr => '>(tinterval,tinterval)', amopmethod => 'btree' }, - # btree array_ops { amopfamily => 'btree/array_ops', amoplefttype => 'anyarray', @@ -1036,16 +982,6 @@ { amopfamily => 'hash/cid_ops', amoplefttype => 'cid', amoprighttype => 'cid', amopstrategy => '1', amopopr => '=(cid,cid)', amopmethod => 'hash' }, -# abstime_ops -{ amopfamily => 'hash/abstime_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '1', - amopopr => '=(abstime,abstime)', amopmethod => 'hash' }, - -# reltime_ops -{ amopfamily => 'hash/reltime_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '1', - amopopr => '=(reltime,reltime)', amopmethod => 'hash' }, - # text_pattern_ops { amopfamily => 'hash/text_pattern_ops', amoplefttype => 'text', amoprighttype => 'text', amopstrategy => '1', amopopr => '=(text,text)', @@ -1989,40 +1925,6 @@ amoprighttype => 'float8', amopstrategy => '5', amopopr => '>(float8,float8)', amopmethod => 'brin' }, -# minmax abstime -{ amopfamily => 'brin/abstime_minmax_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '1', - amopopr => '<(abstime,abstime)', amopmethod => 'brin' }, -{ amopfamily => 'brin/abstime_minmax_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '2', - amopopr => '<=(abstime,abstime)', amopmethod => 'brin' }, -{ amopfamily => 'brin/abstime_minmax_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '3', - amopopr => '=(abstime,abstime)', amopmethod => 'brin' }, -{ amopfamily => 'brin/abstime_minmax_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '4', - amopopr => '>=(abstime,abstime)', amopmethod => 'brin' }, -{ amopfamily => 'brin/abstime_minmax_ops', amoplefttype => 'abstime', - amoprighttype => 'abstime', amopstrategy => '5', - amopopr => '>(abstime,abstime)', amopmethod => 'brin' }, - -# minmax reltime -{ amopfamily => 'brin/reltime_minmax_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '1', - amopopr => '<(reltime,reltime)', amopmethod => 'brin' }, -{ amopfamily => 'brin/reltime_minmax_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '2', - amopopr => '<=(reltime,reltime)', amopmethod => 'brin' }, -{ amopfamily => 'brin/reltime_minmax_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '3', - amopopr => '=(reltime,reltime)', amopmethod => 'brin' }, -{ amopfamily => 'brin/reltime_minmax_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '4', - amopopr => '>=(reltime,reltime)', amopmethod => 'brin' }, -{ amopfamily => 'brin/reltime_minmax_ops', amoplefttype => 'reltime', - amoprighttype => 'reltime', amopstrategy => '5', - amopopr => '>(reltime,reltime)', amopmethod => 'brin' }, - # minmax macaddr { amopfamily => 'brin/macaddr_minmax_ops', amoplefttype => 'macaddr', amoprighttype => 'macaddr', amopstrategy => '1', diff --git a/src/include/catalog/pg_amproc.dat b/src/include/catalog/pg_amproc.dat index 086f76c475..0ef2c0885f 100644 --- a/src/include/catalog/pg_amproc.dat +++ b/src/include/catalog/pg_amproc.dat @@ -15,8 +15,6 @@ # btree { amprocfamily => 'btree/array_ops', amproclefttype => 'anyarray', amprocrighttype => 'anyarray', amprocnum => '1', amproc => 'btarraycmp' }, -{ amprocfamily => 'btree/abstime_ops', amproclefttype => 'abstime', - amprocrighttype => 'abstime', amprocnum => '1', amproc => 'btabstimecmp' }, { amprocfamily => 'btree/bit_ops', amproclefttype => 'bit', amprocrighttype => 'bit', amprocnum => '1', amproc => 'bitcmp' }, { amprocfamily => 'btree/bool_ops', amproclefttype => 'bool', @@ -198,11 +196,6 @@ amproc => 'btbpchar_pattern_sortsupport' }, { amprocfamily => 'btree/money_ops', amproclefttype => 'money', amprocrighttype => 'money', amprocnum => '1', amproc => 'cash_cmp' }, -{ amprocfamily => 'btree/reltime_ops', amproclefttype => 'reltime', - amprocrighttype => 'reltime', amprocnum => '1', amproc => 'btreltimecmp' }, -{ amprocfamily => 'btree/tinterval_ops', amproclefttype => 'tinterval', - amprocrighttype => 'tinterval', amprocnum => '1', - amproc => 'bttintervalcmp' }, { amprocfamily => 'btree/tid_ops', amproclefttype => 'tid', amprocrighttype => 'tid', amprocnum => '1', amproc => 'bttidcmp' }, { amprocfamily => 'btree/uuid_ops', amproclefttype => 'uuid', @@ -343,16 +336,6 @@ amprocrighttype => 'cid', amprocnum => '1', amproc => 'hashint4' }, { amprocfamily => 'hash/cid_ops', amproclefttype => 'cid', amprocrighttype => 'cid', amprocnum => '2', amproc => 'hashint4extended' }, -{ amprocfamily => 'hash/abstime_ops', amproclefttype => 'abstime', - amprocrighttype => 'abstime', amprocnum => '1', amproc => 'hashint4' }, -{ amprocfamily => 'hash/abstime_ops', amproclefttype => 'abstime', - amprocrighttype => 'abstime', amprocnum => '2', - amproc => 'hashint4extended' }, -{ amprocfamily => 'hash/reltime_ops', amproclefttype => 'reltime', - amprocrighttype => 'reltime', amprocnum => '1', amproc => 'hashint4' }, -{ amprocfamily => 'hash/reltime_ops', amproclefttype => 'reltime', - amprocrighttype => 'reltime', amprocnum => '2', - amproc => 'hashint4extended' }, { amprocfamily => 'hash/text_pattern_ops', amproclefttype => 'text', amprocrighttype => 'text', amprocnum => '1', amproc => 'hashtext' }, { amprocfamily => 'hash/text_pattern_ops', amproclefttype => 'text', @@ -917,34 +900,6 @@ amprocrighttype => 'float4', amprocnum => '4', amproc => 'brin_minmax_union' }, -# minmax abstime -{ amprocfamily => 'brin/abstime_minmax_ops', amproclefttype => 'abstime', - amprocrighttype => 'abstime', amprocnum => '1', - amproc => 'brin_minmax_opcinfo' }, -{ amprocfamily => 'brin/abstime_minmax_ops', amproclefttype => 'abstime', - amprocrighttype => 'abstime', amprocnum => '2', - amproc => 'brin_minmax_add_value' }, -{ amprocfamily => 'brin/abstime_minmax_ops', amproclefttype => 'abstime', - amprocrighttype => 'abstime', amprocnum => '3', - amproc => 'brin_minmax_consistent' }, -{ amprocfamily => 'brin/abstime_minmax_ops', amproclefttype => 'abstime', - amprocrighttype => 'abstime', amprocnum => '4', - amproc => 'brin_minmax_union' }, - -# minmax reltime -{ amprocfamily => 'brin/reltime_minmax_ops', amproclefttype => 'reltime', - amprocrighttype => 'reltime', amprocnum => '1', - amproc => 'brin_minmax_opcinfo' }, -{ amprocfamily => 'brin/reltime_minmax_ops', amproclefttype => 'reltime', - amprocrighttype => 'reltime', amprocnum => '2', - amproc => 'brin_minmax_add_value' }, -{ amprocfamily => 'brin/reltime_minmax_ops', amproclefttype => 'reltime', - amprocrighttype => 'reltime', amprocnum => '3', - amproc => 'brin_minmax_consistent' }, -{ amprocfamily => 'brin/reltime_minmax_ops', amproclefttype => 'reltime', - amprocrighttype => 'reltime', amprocnum => '4', - amproc => 'brin_minmax_union' }, - # minmax macaddr { amprocfamily => 'brin/macaddr_minmax_ops', amproclefttype => 'macaddr', amprocrighttype => 'macaddr', amprocnum => '1', diff --git a/src/include/catalog/pg_cast.dat b/src/include/catalog/pg_cast.dat index cf007528fd..8cd65b3ab5 100644 --- a/src/include/catalog/pg_cast.dat +++ b/src/include/catalog/pg_cast.dat @@ -325,16 +325,6 @@ castcontext => 'i', castmethod => 'i' }, # Datetime category -{ castsource => 'abstime', casttarget => 'date', castfunc => 'date(abstime)', - castcontext => 'a', castmethod => 'f' }, -{ castsource => 'abstime', casttarget => 'time', castfunc => 'time(abstime)', - castcontext => 'a', castmethod => 'f' }, -{ castsource => 'abstime', casttarget => 'timestamp', - castfunc => 'timestamp(abstime)', castcontext => 'i', castmethod => 'f' }, -{ castsource => 'abstime', casttarget => 'timestamptz', - castfunc => 'timestamptz(abstime)', castcontext => 'i', castmethod => 'f' }, -{ castsource => 'reltime', casttarget => 'interval', - castfunc => 'interval(reltime)', castcontext => 'i', castmethod => 'f' }, { castsource => 'date', casttarget => 'timestamp', castfunc => 'timestamp(date)', castcontext => 'i', castmethod => 'f' }, { castsource => 'date', casttarget => 'timestamptz', @@ -343,16 +333,12 @@ castcontext => 'i', castmethod => 'f' }, { castsource => 'time', casttarget => 'timetz', castfunc => 'timetz(time)', castcontext => 'i', castmethod => 'f' }, -{ castsource => 'timestamp', casttarget => 'abstime', - castfunc => 'abstime(timestamp)', castcontext => 'a', castmethod => 'f' }, { castsource => 'timestamp', casttarget => 'date', castfunc => 'date(timestamp)', castcontext => 'a', castmethod => 'f' }, { castsource => 'timestamp', casttarget => 'time', castfunc => 'time(timestamp)', castcontext => 'a', castmethod => 'f' }, { castsource => 'timestamp', casttarget => 'timestamptz', castfunc => 'timestamptz(timestamp)', castcontext => 'i', castmethod => 'f' }, -{ castsource => 'timestamptz', casttarget => 'abstime', - castfunc => 'abstime(timestamptz)', castcontext => 'a', castmethod => 'f' }, { castsource => 'timestamptz', casttarget => 'date', castfunc => 'date(timestamptz)', castcontext => 'a', castmethod => 'f' }, { castsource => 'timestamptz', casttarget => 'time', @@ -361,23 +347,11 @@ castfunc => 'timestamp(timestamptz)', castcontext => 'a', castmethod => 'f' }, { castsource => 'timestamptz', casttarget => 'timetz', castfunc => 'timetz(timestamptz)', castcontext => 'a', castmethod => 'f' }, -{ castsource => 'interval', casttarget => 'reltime', castfunc => 'reltime', - castcontext => 'a', castmethod => 'f' }, { castsource => 'interval', casttarget => 'time', castfunc => 'time(interval)', castcontext => 'a', castmethod => 'f' }, { castsource => 'timetz', casttarget => 'time', castfunc => 'time(timetz)', castcontext => 'a', castmethod => 'f' }, -# Cross-category casts between int4 and abstime, reltime -{ castsource => 'int4', casttarget => 'abstime', castfunc => '0', - castcontext => 'e', castmethod => 'b' }, -{ castsource => 'abstime', casttarget => 'int4', castfunc => '0', - castcontext => 'e', castmethod => 'b' }, -{ castsource => 'int4', casttarget => 'reltime', castfunc => '0', - castcontext => 'e', castmethod => 'b' }, -{ castsource => 'reltime', casttarget => 'int4', castfunc => '0', - castcontext => 'e', castmethod => 'b' }, - # Geometric category { castsource => 'point', casttarget => 'box', castfunc => 'box(point)', castcontext => 'a', castmethod => 'f' }, diff --git a/src/include/catalog/pg_opclass.dat b/src/include/catalog/pg_opclass.dat index 5271c5c915..13928ba4a0 100644 --- a/src/include/catalog/pg_opclass.dat +++ b/src/include/catalog/pg_opclass.dat @@ -16,8 +16,6 @@ # referenced in the C code or in built-in catalog entries. The rest get OIDs # assigned on-the-fly during initdb. -{ opcmethod => 'btree', opcname => 'abstime_ops', - opcfamily => 'btree/abstime_ops', opcintype => 'abstime' }, { opcmethod => 'btree', opcname => 'array_ops', opcfamily => 'btree/array_ops', opcintype => 'anyarray' }, { opcmethod => 'hash', opcname => 'array_ops', opcfamily => 'hash/array_ops', @@ -169,10 +167,6 @@ opcintype => 'xid' }, { opcmethod => 'hash', opcname => 'cid_ops', opcfamily => 'hash/cid_ops', opcintype => 'cid' }, -{ opcmethod => 'hash', opcname => 'abstime_ops', - opcfamily => 'hash/abstime_ops', opcintype => 'abstime' }, -{ opcmethod => 'hash', opcname => 'reltime_ops', - opcfamily => 'hash/reltime_ops', opcintype => 'reltime' }, { opcmethod => 'hash', opcname => 'text_pattern_ops', opcfamily => 'hash/text_pattern_ops', opcintype => 'text', opcdefault => 'f' }, @@ -182,10 +176,6 @@ { opcmethod => 'hash', opcname => 'bpchar_pattern_ops', opcfamily => 'hash/bpchar_pattern_ops', opcintype => 'bpchar', opcdefault => 'f' }, -{ opcmethod => 'btree', opcname => 'reltime_ops', - opcfamily => 'btree/reltime_ops', opcintype => 'reltime' }, -{ opcmethod => 'btree', opcname => 'tinterval_ops', - opcfamily => 'btree/tinterval_ops', opcintype => 'tinterval' }, { opcmethod => 'hash', opcname => 'aclitem_ops', opcfamily => 'hash/aclitem_ops', opcintype => 'aclitem' }, { opcmethod => 'gist', opcname => 'box_ops', opcfamily => 'gist/box_ops', @@ -286,12 +276,6 @@ { opcmethod => 'brin', opcname => 'float8_minmax_ops', opcfamily => 'brin/float_minmax_ops', opcintype => 'float8', opckeytype => 'float8' }, -{ opcmethod => 'brin', opcname => 'abstime_minmax_ops', - opcfamily => 'brin/abstime_minmax_ops', opcintype => 'abstime', - opckeytype => 'abstime' }, -{ opcmethod => 'brin', opcname => 'reltime_minmax_ops', - opcfamily => 'brin/reltime_minmax_ops', opcintype => 'reltime', - opckeytype => 'reltime' }, { opcmethod => 'brin', opcname => 'macaddr_minmax_ops', opcfamily => 'brin/macaddr_minmax_ops', opcintype => 'macaddr', opckeytype => 'macaddr' }, diff --git a/src/include/catalog/pg_operator.dat b/src/include/catalog/pg_operator.dat index d9b6bad614..ce23c2f0aa 100644 --- a/src/include/catalog/pg_operator.dat +++ b/src/include/catalog/pg_operator.dat @@ -498,110 +498,6 @@ { oid => '559', descr => 'negate', oprname => '-', oprkind => 'l', oprleft => '0', oprright => 'int2', oprresult => 'int2', oprcode => 'int2um' }, -{ oid => '560', descr => 'equal', - oprname => '=', oprcanmerge => 't', oprcanhash => 't', oprleft => 'abstime', - oprright => 'abstime', oprresult => 'bool', oprcom => '=(abstime,abstime)', - oprnegate => '<>(abstime,abstime)', oprcode => 'abstimeeq', - oprrest => 'eqsel', oprjoin => 'eqjoinsel' }, -{ oid => '561', descr => 'not equal', - oprname => '<>', oprleft => 'abstime', oprright => 'abstime', - oprresult => 'bool', oprcom => '<>(abstime,abstime)', - oprnegate => '=(abstime,abstime)', oprcode => 'abstimene', - oprrest => 'neqsel', oprjoin => 'neqjoinsel' }, -{ oid => '562', descr => 'less than', - oprname => '<', oprleft => 'abstime', oprright => 'abstime', - oprresult => 'bool', oprcom => '>(abstime,abstime)', - oprnegate => '>=(abstime,abstime)', oprcode => 'abstimelt', - oprrest => 'scalarltsel', oprjoin => 'scalarltjoinsel' }, -{ oid => '563', descr => 'greater than', - oprname => '>', oprleft => 'abstime', oprright => 'abstime', - oprresult => 'bool', oprcom => '<(abstime,abstime)', - oprnegate => '<=(abstime,abstime)', oprcode => 'abstimegt', - oprrest => 'scalargtsel', oprjoin => 'scalargtjoinsel' }, -{ oid => '564', descr => 'less than or equal', - oprname => '<=', oprleft => 'abstime', oprright => 'abstime', - oprresult => 'bool', oprcom => '>=(abstime,abstime)', - oprnegate => '>(abstime,abstime)', oprcode => 'abstimele', - oprrest => 'scalarlesel', oprjoin => 'scalarlejoinsel' }, -{ oid => '565', descr => 'greater than or equal', - oprname => '>=', oprleft => 'abstime', oprright => 'abstime', - oprresult => 'bool', oprcom => '<=(abstime,abstime)', - oprnegate => '<(abstime,abstime)', oprcode => 'abstimege', - oprrest => 'scalargesel', oprjoin => 'scalargejoinsel' }, -{ oid => '566', descr => 'equal', - oprname => '=', oprcanmerge => 't', oprcanhash => 't', oprleft => 'reltime', - oprright => 'reltime', oprresult => 'bool', oprcom => '=(reltime,reltime)', - oprnegate => '<>(reltime,reltime)', oprcode => 'reltimeeq', - oprrest => 'eqsel', oprjoin => 'eqjoinsel' }, -{ oid => '567', descr => 'not equal', - oprname => '<>', oprleft => 'reltime', oprright => 'reltime', - oprresult => 'bool', oprcom => '<>(reltime,reltime)', - oprnegate => '=(reltime,reltime)', oprcode => 'reltimene', - oprrest => 'neqsel', oprjoin => 'neqjoinsel' }, -{ oid => '568', descr => 'less than', - oprname => '<', oprleft => 'reltime', oprright => 'reltime', - oprresult => 'bool', oprcom => '>(reltime,reltime)', - oprnegate => '>=(reltime,reltime)', oprcode => 'reltimelt', - oprrest => 'scalarltsel', oprjoin => 'scalarltjoinsel' }, -{ oid => '569', descr => 'greater than', - oprname => '>', oprleft => 'reltime', oprright => 'reltime', - oprresult => 'bool', oprcom => '<(reltime,reltime)', - oprnegate => '<=(reltime,reltime)', oprcode => 'reltimegt', - oprrest => 'scalargtsel', oprjoin => 'scalargtjoinsel' }, -{ oid => '570', descr => 'less than or equal', - oprname => '<=', oprleft => 'reltime', oprright => 'reltime', - oprresult => 'bool', oprcom => '>=(reltime,reltime)', - oprnegate => '>(reltime,reltime)', oprcode => 'reltimele', - oprrest => 'scalarlesel', oprjoin => 'scalarlejoinsel' }, -{ oid => '571', descr => 'greater than or equal', - oprname => '>=', oprleft => 'reltime', oprright => 'reltime', - oprresult => 'bool', oprcom => '<=(reltime,reltime)', - oprnegate => '<(reltime,reltime)', oprcode => 'reltimege', - oprrest => 'scalargesel', oprjoin => 'scalargejoinsel' }, -{ oid => '572', descr => 'same as', - oprname => '~=', oprleft => 'tinterval', oprright => 'tinterval', - oprresult => 'bool', oprcom => '~=(tinterval,tinterval)', - oprcode => 'tintervalsame', oprrest => 'eqsel', oprjoin => 'eqjoinsel' }, -{ oid => '573', descr => 'contains', - oprname => '<<', oprleft => 'tinterval', oprright => 'tinterval', - oprresult => 'bool', oprcode => 'tintervalct' }, -{ oid => '574', descr => 'overlaps', - oprname => '&&', oprleft => 'tinterval', oprright => 'tinterval', - oprresult => 'bool', oprcom => '&&(tinterval,tinterval)', - oprcode => 'tintervalov' }, -{ oid => '575', descr => 'equal by length', - oprname => '#=', oprleft => 'tinterval', oprright => 'reltime', - oprresult => 'bool', oprnegate => '#<>(tinterval,reltime)', - oprcode => 'tintervalleneq' }, -{ oid => '576', descr => 'not equal by length', - oprname => '#<>', oprleft => 'tinterval', oprright => 'reltime', - oprresult => 'bool', oprnegate => '#=(tinterval,reltime)', - oprcode => 'tintervallenne' }, -{ oid => '577', descr => 'less than by length', - oprname => '#<', oprleft => 'tinterval', oprright => 'reltime', - oprresult => 'bool', oprnegate => '#>=(tinterval,reltime)', - oprcode => 'tintervallenlt' }, -{ oid => '578', descr => 'greater than by length', - oprname => '#>', oprleft => 'tinterval', oprright => 'reltime', - oprresult => 'bool', oprnegate => '#<=(tinterval,reltime)', - oprcode => 'tintervallengt' }, -{ oid => '579', descr => 'less than or equal by length', - oprname => '#<=', oprleft => 'tinterval', oprright => 'reltime', - oprresult => 'bool', oprnegate => '#>(tinterval,reltime)', - oprcode => 'tintervallenle' }, -{ oid => '580', descr => 'greater than or equal by length', - oprname => '#>=', oprleft => 'tinterval', oprright => 'reltime', - oprresult => 'bool', oprnegate => '#<(tinterval,reltime)', - oprcode => 'tintervallenge' }, -{ oid => '581', descr => 'add', - oprname => '+', oprleft => 'abstime', oprright => 'reltime', - oprresult => 'abstime', oprcode => 'timepl' }, -{ oid => '582', descr => 'subtract', - oprname => '-', oprleft => 'abstime', oprright => 'reltime', - oprresult => 'abstime', oprcode => 'timemi' }, -{ oid => '583', descr => 'is contained by', - oprname => '', oprleft => 'abstime', oprright => 'tinterval', - oprresult => 'bool', oprcode => 'intinterval' }, { oid => '584', descr => 'negate', oprname => '-', oprkind => 'l', oprleft => '0', oprright => 'float4', oprresult => 'float4', oprcode => 'float4um' }, @@ -644,12 +540,6 @@ { oid => '597', descr => 'cube root', oprname => '||/', oprkind => 'l', oprleft => '0', oprright => 'float8', oprresult => 'float8', oprcode => 'dcbrt' }, -{ oid => '1284', descr => 'start of interval', - oprname => '|', oprkind => 'l', oprleft => '0', oprright => 'tinterval', - oprresult => 'abstime', oprcode => 'tintervalstart' }, -{ oid => '606', descr => 'convert to tinterval', - oprname => '<#>', oprleft => 'abstime', oprright => 'abstime', - oprresult => 'tinterval', oprcode => 'mktinterval' }, { oid => '607', descr => 'equal', oprname => '=', oprcanmerge => 't', oprcanhash => 't', oprleft => 'oid', @@ -1075,37 +965,6 @@ oprname => '?|', oprleft => 'point', oprright => 'point', oprresult => 'bool', oprcom => '?|(point,point)', oprcode => 'point_vert' }, -{ oid => '811', descr => 'equal', - oprname => '=', oprcanmerge => 't', oprleft => 'tinterval', - oprright => 'tinterval', oprresult => 'bool', - oprcom => '=(tinterval,tinterval)', oprnegate => '<>(tinterval,tinterval)', - oprcode => 'tintervaleq', oprrest => 'eqsel', oprjoin => 'eqjoinsel' }, -{ oid => '812', descr => 'not equal', - oprname => '<>', oprleft => 'tinterval', oprright => 'tinterval', - oprresult => 'bool', oprcom => '<>(tinterval,tinterval)', - oprnegate => '=(tinterval,tinterval)', oprcode => 'tintervalne', - oprrest => 'neqsel', oprjoin => 'neqjoinsel' }, -{ oid => '813', descr => 'less than', - oprname => '<', oprleft => 'tinterval', oprright => 'tinterval', - oprresult => 'bool', oprcom => '>(tinterval,tinterval)', - oprnegate => '>=(tinterval,tinterval)', oprcode => 'tintervallt', - oprrest => 'scalarltsel', oprjoin => 'scalarltjoinsel' }, -{ oid => '814', descr => 'greater than', - oprname => '>', oprleft => 'tinterval', oprright => 'tinterval', - oprresult => 'bool', oprcom => '<(tinterval,tinterval)', - oprnegate => '<=(tinterval,tinterval)', oprcode => 'tintervalgt', - oprrest => 'scalargtsel', oprjoin => 'scalargtjoinsel' }, -{ oid => '815', descr => 'less than or equal', - oprname => '<=', oprleft => 'tinterval', oprright => 'tinterval', - oprresult => 'bool', oprcom => '>=(tinterval,tinterval)', - oprnegate => '>(tinterval,tinterval)', oprcode => 'tintervalle', - oprrest => 'scalarlesel', oprjoin => 'scalarlejoinsel' }, -{ oid => '816', descr => 'greater than or equal', - oprname => '>=', oprleft => 'tinterval', oprright => 'tinterval', - oprresult => 'bool', oprcom => '<=(tinterval,tinterval)', - oprnegate => '<(tinterval,tinterval)', oprcode => 'tintervalge', - oprrest => 'scalargesel', oprjoin => 'scalargejoinsel' }, - { oid => '843', descr => 'multiply', oprname => '*', oprleft => 'money', oprright => 'float4', oprresult => 'money', oprcom => '*(float4,money)', diff --git a/src/include/catalog/pg_opfamily.dat b/src/include/catalog/pg_opfamily.dat index 4a9a28b87e..20b2224c54 100644 --- a/src/include/catalog/pg_opfamily.dat +++ b/src/include/catalog/pg_opfamily.dat @@ -12,8 +12,6 @@ [ -{ oid => '421', - opfmethod => 'btree', opfname => 'abstime_ops' }, { oid => '397', opfmethod => 'btree', opfname => 'array_ops' }, { oid => '627', @@ -118,18 +116,10 @@ opfmethod => 'hash', opfname => 'xid_ops' }, { oid => '2226', opfmethod => 'hash', opfname => 'cid_ops' }, -{ oid => '2227', - opfmethod => 'hash', opfname => 'abstime_ops' }, -{ oid => '2228', - opfmethod => 'hash', opfname => 'reltime_ops' }, { oid => '2229', opfmethod => 'hash', opfname => 'text_pattern_ops' }, { oid => '2231', opfmethod => 'hash', opfname => 'bpchar_pattern_ops' }, -{ oid => '2233', - opfmethod => 'btree', opfname => 'reltime_ops' }, -{ oid => '2234', - opfmethod => 'btree', opfname => 'tinterval_ops' }, { oid => '2235', opfmethod => 'hash', opfname => 'aclitem_ops' }, { oid => '2593', @@ -210,10 +200,6 @@ opfmethod => 'brin', opfname => 'tid_minmax_ops' }, { oid => '4070', opfmethod => 'brin', opfname => 'float_minmax_ops' }, -{ oid => '4072', - opfmethod => 'brin', opfname => 'abstime_minmax_ops' }, -{ oid => '4073', - opfmethod => 'brin', opfname => 'reltime_minmax_ops' }, { oid => '4074', opfmethod => 'brin', opfname => 'macaddr_minmax_ops' }, { oid => '4109', diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index 038a11d6cd..cff58ed2d8 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -673,115 +673,10 @@ proname => 'line_distance', prorettype => 'float8', proargtypes => 'line line', prosrc => 'line_distance' }, -{ oid => '240', descr => 'I/O', - proname => 'abstimein', provolatile => 's', prorettype => 'abstime', - proargtypes => 'cstring', prosrc => 'abstimein' }, -{ oid => '241', descr => 'I/O', - proname => 'abstimeout', provolatile => 's', prorettype => 'cstring', - proargtypes => 'abstime', prosrc => 'abstimeout' }, -{ oid => '242', descr => 'I/O', - proname => 'reltimein', provolatile => 's', prorettype => 'reltime', - proargtypes => 'cstring', prosrc => 'reltimein' }, -{ oid => '243', descr => 'I/O', - proname => 'reltimeout', provolatile => 's', prorettype => 'cstring', - proargtypes => 'reltime', prosrc => 'reltimeout' }, -{ oid => '244', - proname => 'timepl', prorettype => 'abstime', - proargtypes => 'abstime reltime', prosrc => 'timepl' }, -{ oid => '245', - proname => 'timemi', prorettype => 'abstime', - proargtypes => 'abstime reltime', prosrc => 'timemi' }, -{ oid => '246', descr => 'I/O', - proname => 'tintervalin', provolatile => 's', prorettype => 'tinterval', - proargtypes => 'cstring', prosrc => 'tintervalin' }, -{ oid => '247', descr => 'I/O', - proname => 'tintervalout', provolatile => 's', prorettype => 'cstring', - proargtypes => 'tinterval', prosrc => 'tintervalout' }, -{ oid => '248', - proname => 'intinterval', prorettype => 'bool', - proargtypes => 'abstime tinterval', prosrc => 'intinterval' }, -{ oid => '249', descr => 'tinterval to reltime', - proname => 'tintervalrel', prorettype => 'reltime', - proargtypes => 'tinterval', prosrc => 'tintervalrel' }, -{ oid => '250', descr => 'current date and time (abstime)', - proname => 'timenow', provolatile => 's', prorettype => 'abstime', - proargtypes => '', prosrc => 'timenow' }, -{ oid => '251', - proname => 'abstimeeq', proleakproof => 't', prorettype => 'bool', - proargtypes => 'abstime abstime', prosrc => 'abstimeeq' }, -{ oid => '252', - proname => 'abstimene', proleakproof => 't', prorettype => 'bool', - proargtypes => 'abstime abstime', prosrc => 'abstimene' }, -{ oid => '253', - proname => 'abstimelt', proleakproof => 't', prorettype => 'bool', - proargtypes => 'abstime abstime', prosrc => 'abstimelt' }, -{ oid => '254', - proname => 'abstimegt', proleakproof => 't', prorettype => 'bool', - proargtypes => 'abstime abstime', prosrc => 'abstimegt' }, -{ oid => '255', - proname => 'abstimele', proleakproof => 't', prorettype => 'bool', - proargtypes => 'abstime abstime', prosrc => 'abstimele' }, -{ oid => '256', - proname => 'abstimege', proleakproof => 't', prorettype => 'bool', - proargtypes => 'abstime abstime', prosrc => 'abstimege' }, -{ oid => '257', - proname => 'reltimeeq', proleakproof => 't', prorettype => 'bool', - proargtypes => 'reltime reltime', prosrc => 'reltimeeq' }, -{ oid => '258', - proname => 'reltimene', proleakproof => 't', prorettype => 'bool', - proargtypes => 'reltime reltime', prosrc => 'reltimene' }, -{ oid => '259', - proname => 'reltimelt', proleakproof => 't', prorettype => 'bool', - proargtypes => 'reltime reltime', prosrc => 'reltimelt' }, -{ oid => '260', - proname => 'reltimegt', proleakproof => 't', prorettype => 'bool', - proargtypes => 'reltime reltime', prosrc => 'reltimegt' }, -{ oid => '261', - proname => 'reltimele', proleakproof => 't', prorettype => 'bool', - proargtypes => 'reltime reltime', prosrc => 'reltimele' }, -{ oid => '262', - proname => 'reltimege', proleakproof => 't', prorettype => 'bool', - proargtypes => 'reltime reltime', prosrc => 'reltimege' }, -{ oid => '263', - proname => 'tintervalsame', prorettype => 'bool', - proargtypes => 'tinterval tinterval', prosrc => 'tintervalsame' }, -{ oid => '264', - proname => 'tintervalct', prorettype => 'bool', - proargtypes => 'tinterval tinterval', prosrc => 'tintervalct' }, -{ oid => '265', - proname => 'tintervalov', prorettype => 'bool', - proargtypes => 'tinterval tinterval', prosrc => 'tintervalov' }, -{ oid => '266', - proname => 'tintervalleneq', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval reltime', prosrc => 'tintervalleneq' }, -{ oid => '267', - proname => 'tintervallenne', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval reltime', prosrc => 'tintervallenne' }, -{ oid => '268', - proname => 'tintervallenlt', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval reltime', prosrc => 'tintervallenlt' }, -{ oid => '269', - proname => 'tintervallengt', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval reltime', prosrc => 'tintervallengt' }, -{ oid => '270', - proname => 'tintervallenle', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval reltime', prosrc => 'tintervallenle' }, -{ oid => '271', - proname => 'tintervallenge', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval reltime', prosrc => 'tintervallenge' }, -{ oid => '272', - proname => 'tintervalstart', prorettype => 'abstime', - proargtypes => 'tinterval', prosrc => 'tintervalstart' }, -{ oid => '273', descr => 'end of interval', - proname => 'tintervalend', prorettype => 'abstime', - proargtypes => 'tinterval', prosrc => 'tintervalend' }, { oid => '274', descr => 'current date and time - increments during transactions', proname => 'timeofday', provolatile => 'v', prorettype => 'text', proargtypes => '', prosrc => 'timeofday' }, -{ oid => '275', descr => 'finite abstime?', - proname => 'isfinite', prorettype => 'bool', proargtypes => 'abstime', - prosrc => 'abstime_finite' }, { oid => '277', proname => 'inter_sl', prorettype => 'bool', proargtypes => 'lseg line', @@ -1042,9 +937,6 @@ { oid => '404', descr => 'less-equal-greater', proname => 'btoidvectorcmp', prorettype => 'int4', proargtypes => 'oidvector oidvector', prosrc => 'btoidvectorcmp' }, -{ oid => '357', descr => 'less-equal-greater', - proname => 'btabstimecmp', proleakproof => 't', prorettype => 'int4', - proargtypes => 'abstime abstime', prosrc => 'btabstimecmp' }, { oid => '358', descr => 'less-equal-greater', proname => 'btcharcmp', proleakproof => 't', prorettype => 'int4', proargtypes => 'char char', prosrc => 'btcharcmp' }, @@ -1063,12 +955,6 @@ { oid => '377', descr => 'less-equal-greater', proname => 'cash_cmp', proleakproof => 't', prorettype => 'int4', proargtypes => 'money money', prosrc => 'cash_cmp' }, -{ oid => '380', descr => 'less-equal-greater', - proname => 'btreltimecmp', proleakproof => 't', prorettype => 'int4', - proargtypes => 'reltime reltime', prosrc => 'btreltimecmp' }, -{ oid => '381', descr => 'less-equal-greater', - proname => 'bttintervalcmp', proleakproof => 't', prorettype => 'int4', - proargtypes => 'tinterval tinterval', prosrc => 'bttintervalcmp' }, { oid => '382', descr => 'less-equal-greater', proname => 'btarraycmp', prorettype => 'int4', proargtypes => 'anyarray anyarray', prosrc => 'btarraycmp' }, @@ -1401,10 +1287,6 @@ prorettype => 'varchar', proargtypes => 'varchar int4 bool', prosrc => 'varchar' }, -{ oid => '676', - proname => 'mktinterval', prorettype => 'tinterval', - proargtypes => 'abstime abstime', prosrc => 'mktinterval' }, - { oid => '619', proname => 'oidvectorne', prorettype => 'bool', proargtypes => 'oidvector oidvector', prosrc => 'oidvectorne' }, @@ -1689,25 +1571,6 @@ proname => 'int2smaller', prorettype => 'int2', proargtypes => 'int2 int2', prosrc => 'int2smaller' }, -{ oid => '784', - proname => 'tintervaleq', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval tinterval', prosrc => 'tintervaleq' }, -{ oid => '785', - proname => 'tintervalne', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval tinterval', prosrc => 'tintervalne' }, -{ oid => '786', - proname => 'tintervallt', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval tinterval', prosrc => 'tintervallt' }, -{ oid => '787', - proname => 'tintervalgt', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval tinterval', prosrc => 'tintervalgt' }, -{ oid => '788', - proname => 'tintervalle', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval tinterval', prosrc => 'tintervalle' }, -{ oid => '789', - proname => 'tintervalge', proleakproof => 't', prorettype => 'bool', - proargtypes => 'tinterval tinterval', prosrc => 'tintervalge' }, - # OIDS 800 - 899 { oid => '846', @@ -2333,9 +2196,6 @@ { oid => '1172', descr => 'extract field from interval', proname => 'date_part', prorettype => 'float8', proargtypes => 'text interval', prosrc => 'interval_part' }, -{ oid => '1173', descr => 'convert abstime to timestamp with time zone', - proname => 'timestamptz', prorettype => 'timestamptz', - proargtypes => 'abstime', prosrc => 'abstime_timestamptz' }, { oid => '1174', descr => 'convert date to timestamp with time zone', proname => 'timestamptz', provolatile => 's', prorettype => 'timestamptz', proargtypes => 'date', prosrc => 'date_timestamptz' }, @@ -2353,18 +2213,9 @@ proname => 'timestamptz', prolang => '14', provolatile => 's', prorettype => 'timestamptz', proargtypes => 'date time', prosrc => 'select cast(($1 + $2) as timestamp with time zone)' }, -{ oid => '1177', descr => 'convert reltime to interval', - proname => 'interval', prorettype => 'interval', proargtypes => 'reltime', - prosrc => 'reltime_interval' }, { oid => '1178', descr => 'convert timestamp with time zone to date', proname => 'date', provolatile => 's', prorettype => 'date', proargtypes => 'timestamptz', prosrc => 'timestamptz_date' }, -{ oid => '1179', descr => 'convert abstime to date', - proname => 'date', provolatile => 's', prorettype => 'date', - proargtypes => 'abstime', prosrc => 'abstime_date' }, -{ oid => '1180', descr => 'convert timestamp with time zone to abstime', - proname => 'abstime', prorettype => 'abstime', proargtypes => 'timestamptz', - prosrc => 'timestamptz_abstime' }, { oid => '1181', descr => 'age of a transaction ID, in transactions before current transaction', proname => 'age', provolatile => 's', proparallel => 'r', @@ -2385,9 +2236,6 @@ proname => 'timestamptz_mi_interval', provolatile => 's', prorettype => 'timestamptz', proargtypes => 'timestamptz interval', prosrc => 'timestamptz_mi_interval' }, -{ oid => '1194', descr => 'convert interval to reltime', - proname => 'reltime', prorettype => 'reltime', proargtypes => 'interval', - prosrc => 'interval_reltime' }, { oid => '1195', descr => 'smaller of two', proname => 'timestamptz_smaller', prorettype => 'timestamptz', proargtypes => 'timestamptz timestamptz', prosrc => 'timestamp_smaller' }, @@ -2786,11 +2634,6 @@ proname => 'timestamptz', prorettype => 'timestamptz', proargtypes => 'date timetz', prosrc => 'datetimetz_timestamptz' }, -{ oid => '1364', descr => 'convert abstime to time', - proname => 'time', prolang => '14', provolatile => 's', prorettype => 'time', - proargtypes => 'abstime', - prosrc => 'select cast(cast($1 as timestamp without time zone) as pg_catalog.time)' }, - { oid => '1367', descr => 'character length', proname => 'character_length', prorettype => 'int4', proargtypes => 'bpchar', prosrc => 'bpcharlen' }, @@ -2828,14 +2671,6 @@ proname => 'char_length', prorettype => 'int4', proargtypes => 'text', prosrc => 'textlen' }, -{ oid => '1382', descr => 'extract field from abstime', - proname => 'date_part', prolang => '14', provolatile => 's', - prorettype => 'float8', proargtypes => 'text abstime', - prosrc => 'select pg_catalog.date_part($1, cast($2 as timestamp with time zone))' }, -{ oid => '1383', descr => 'extract field from reltime', - proname => 'date_part', prolang => '14', provolatile => 's', - prorettype => 'float8', proargtypes => 'text reltime', - prosrc => 'select pg_catalog.date_part($1, cast($2 as pg_catalog.interval))' }, { oid => '1384', descr => 'extract field from date', proname => 'date_part', prolang => '14', prorettype => 'float8', proargtypes => 'text date', @@ -3132,9 +2967,6 @@ { oid => '1480', descr => 'convert circle to box', proname => 'box', prorettype => 'box', proargtypes => 'circle', prosrc => 'circle_box' }, -{ oid => '1481', descr => 'convert to tinterval', - proname => 'tinterval', prorettype => 'tinterval', - proargtypes => 'abstime abstime', prosrc => 'mktinterval' }, { oid => '1482', proname => 'lseg_ne', proleakproof => 't', prorettype => 'bool', @@ -5642,9 +5474,6 @@ { oid => '2021', descr => 'extract field from timestamp', proname => 'date_part', prorettype => 'float8', proargtypes => 'text timestamp', prosrc => 'timestamp_part' }, -{ oid => '2023', descr => 'convert abstime to timestamp', - proname => 'timestamp', provolatile => 's', prorettype => 'timestamp', - proargtypes => 'abstime', prosrc => 'abstime_timestamp' }, { oid => '2024', descr => 'convert date to timestamp', proname => 'timestamp', prorettype => 'timestamp', proargtypes => 'date', prosrc => 'date_timestamp' }, @@ -5660,9 +5489,6 @@ { oid => '2029', descr => 'convert timestamp to date', proname => 'date', prorettype => 'date', proargtypes => 'timestamp', prosrc => 'timestamp_date' }, -{ oid => '2030', descr => 'convert timestamp to abstime', - proname => 'abstime', provolatile => 's', prorettype => 'abstime', - proargtypes => 'timestamp', prosrc => 'timestamp_abstime' }, { oid => '2031', proname => 'timestamp_mi', prorettype => 'interval', proargtypes => 'timestamp timestamp', prosrc => 'timestamp_mi' }, @@ -6218,9 +6044,6 @@ { oid => '2120', descr => 'maximum value of all float8 input values', proname => 'max', prokind => 'a', proisstrict => 'f', prorettype => 'float8', proargtypes => 'float8', prosrc => 'aggregate_dummy' }, -{ oid => '2121', descr => 'maximum value of all abstime input values', - proname => 'max', prokind => 'a', proisstrict => 'f', prorettype => 'abstime', - proargtypes => 'abstime', prosrc => 'aggregate_dummy' }, { oid => '2122', descr => 'maximum value of all date input values', proname => 'max', prokind => 'a', proisstrict => 'f', prorettype => 'date', proargtypes => 'date', prosrc => 'aggregate_dummy' }, @@ -6285,9 +6108,6 @@ { oid => '2136', descr => 'minimum value of all float8 input values', proname => 'min', prokind => 'a', proisstrict => 'f', prorettype => 'float8', proargtypes => 'float8', prosrc => 'aggregate_dummy' }, -{ oid => '2137', descr => 'minimum value of all abstime input values', - proname => 'min', prokind => 'a', proisstrict => 'f', prorettype => 'abstime', - proargtypes => 'abstime', prosrc => 'aggregate_dummy' }, { oid => '2138', descr => 'minimum value of all date input values', proname => 'min', prokind => 'a', proisstrict => 'f', prorettype => 'date', proargtypes => 'date', prosrc => 'aggregate_dummy' }, @@ -7462,24 +7282,6 @@ { oid => '2461', descr => 'I/O', proname => 'numeric_send', prorettype => 'bytea', proargtypes => 'numeric', prosrc => 'numeric_send' }, -{ oid => '2462', descr => 'I/O', - proname => 'abstimerecv', prorettype => 'abstime', proargtypes => 'internal', - prosrc => 'abstimerecv' }, -{ oid => '2463', descr => 'I/O', - proname => 'abstimesend', prorettype => 'bytea', proargtypes => 'abstime', - prosrc => 'abstimesend' }, -{ oid => '2464', descr => 'I/O', - proname => 'reltimerecv', prorettype => 'reltime', proargtypes => 'internal', - prosrc => 'reltimerecv' }, -{ oid => '2465', descr => 'I/O', - proname => 'reltimesend', prorettype => 'bytea', proargtypes => 'reltime', - prosrc => 'reltimesend' }, -{ oid => '2466', descr => 'I/O', - proname => 'tintervalrecv', prorettype => 'tinterval', - proargtypes => 'internal', prosrc => 'tintervalrecv' }, -{ oid => '2467', descr => 'I/O', - proname => 'tintervalsend', prorettype => 'bytea', proargtypes => 'tinterval', - prosrc => 'tintervalsend' }, { oid => '2468', descr => 'I/O', proname => 'date_recv', prorettype => 'date', proargtypes => 'internal', prosrc => 'date_recv' }, diff --git a/src/include/catalog/pg_type.dat b/src/include/catalog/pg_type.dat index 5840f989e5..d295eae1b9 100644 --- a/src/include/catalog/pg_type.dat +++ b/src/include/catalog/pg_type.dat @@ -225,21 +225,6 @@ typcategory => 'N', typispreferred => 't', typinput => 'float8in', typoutput => 'float8out', typreceive => 'float8recv', typsend => 'float8send', typalign => 'd' }, -{ oid => '702', array_type_oid => '1023', - descr => 'absolute, limited-range date and time (Unix system time)', - typname => 'abstime', typlen => '4', typbyval => 't', typcategory => 'D', - typinput => 'abstimein', typoutput => 'abstimeout', - typreceive => 'abstimerecv', typsend => 'abstimesend', typalign => 'i' }, -{ oid => '703', array_type_oid => '1024', - descr => 'relative, limited-range time interval (Unix delta time)', - typname => 'reltime', typlen => '4', typbyval => 't', typcategory => 'T', - typinput => 'reltimein', typoutput => 'reltimeout', - typreceive => 'reltimerecv', typsend => 'reltimesend', typalign => 'i' }, -{ oid => '704', array_type_oid => '1025', - descr => '(abstime,abstime), time interval', - typname => 'tinterval', typlen => '12', typbyval => 'f', typcategory => 'T', - typinput => 'tintervalin', typoutput => 'tintervalout', - typreceive => 'tintervalrecv', typsend => 'tintervalsend', typalign => 'i' }, { oid => '705', descr => 'pseudo-type representing an undetermined type', typname => 'unknown', typlen => '-2', typbyval => 'f', typtype => 'p', typcategory => 'X', typinput => 'unknownin', typoutput => 'unknownout', diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index d66582b7a2..de9e9ade5c 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -3,7 +3,7 @@ * datetime.h * Definitions for date/time support code. * The support code is shared with other date data types, - * including abstime, reltime, date, and time. + * including date, and time. * * * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group diff --git a/src/include/utils/nabstime.h b/src/include/utils/nabstime.h deleted file mode 100644 index 293a49f022..0000000000 --- a/src/include/utils/nabstime.h +++ /dev/null @@ -1,103 +0,0 @@ -/*------------------------------------------------------------------------- - * - * nabstime.h - * Definitions for the "new" abstime code. - * - * - * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * src/include/utils/nabstime.h - * - *------------------------------------------------------------------------- - */ -#ifndef NABSTIME_H -#define NABSTIME_H - -#include - -#include "fmgr.h" -#include "pgtime.h" - - -/* ---------------------------------------------------------------- - * - * time types + support macros - * - * ---------------------------------------------------------------- - */ - -/* - * Although time_t generally is a long int on 64 bit systems, these two - * types must be 4 bytes, because that's what pg_type.h assumes. They - * should be yanked (long) before 2038 and be replaced by timestamp and - * interval. - */ -typedef int32 AbsoluteTime; -typedef int32 RelativeTime; - -typedef struct -{ - int32 status; - AbsoluteTime data[2]; -} TimeIntervalData; - -typedef TimeIntervalData *TimeInterval; - -/* - * Macros for fmgr-callable functions. - */ -#define DatumGetAbsoluteTime(X) ((AbsoluteTime) DatumGetInt32(X)) -#define DatumGetRelativeTime(X) ((RelativeTime) DatumGetInt32(X)) -#define DatumGetTimeInterval(X) ((TimeInterval) DatumGetPointer(X)) - -#define AbsoluteTimeGetDatum(X) Int32GetDatum(X) -#define RelativeTimeGetDatum(X) Int32GetDatum(X) -#define TimeIntervalGetDatum(X) PointerGetDatum(X) - -#define PG_GETARG_ABSOLUTETIME(n) DatumGetAbsoluteTime(PG_GETARG_DATUM(n)) -#define PG_GETARG_RELATIVETIME(n) DatumGetRelativeTime(PG_GETARG_DATUM(n)) -#define PG_GETARG_TIMEINTERVAL(n) DatumGetTimeInterval(PG_GETARG_DATUM(n)) - -#define PG_RETURN_ABSOLUTETIME(x) return AbsoluteTimeGetDatum(x) -#define PG_RETURN_RELATIVETIME(x) return RelativeTimeGetDatum(x) -#define PG_RETURN_TIMEINTERVAL(x) return TimeIntervalGetDatum(x) - -/* - * Reserved values - * Epoch is Unix system time zero, but needs to be kept as a reserved - * value rather than converting to time since timezone calculations - * might move it away from 1970-01-01 00:00:00Z - tgl 97/02/20 - * - * Pre-v6.1 code had large decimal numbers for reserved values. - * These were chosen as special 32-bit bit patterns, - * so redefine them explicitly using these bit patterns. - tgl 97/02/24 - */ -#define INVALID_ABSTIME ((AbsoluteTime) 0x7FFFFFFE) /* 2147483647 (2^31 - 1) */ -#define NOEND_ABSTIME ((AbsoluteTime) 0x7FFFFFFC) /* 2147483645 (2^31 - 3) */ -#define NOSTART_ABSTIME ((AbsoluteTime) INT_MIN) /* -2147483648 */ - -#define INVALID_RELTIME ((RelativeTime) 0x7FFFFFFE) /* 2147483647 (2^31 - 1) */ - -#define AbsoluteTimeIsValid(time) \ - ((bool) ((time) != INVALID_ABSTIME)) - -/* - * Because NOSTART_ABSTIME is defined as INT_MIN, there can't be any - * AbsoluteTime values less than it. Therefore, we can code the test - * "time > NOSTART_ABSTIME" as "time != NOSTART_ABSTIME", which avoids - * compiler bugs on some platforms. --- tgl & az, 11/2000 - */ -#define AbsoluteTimeIsReal(time) \ - ((bool) (((AbsoluteTime) (time)) < NOEND_ABSTIME && \ - ((AbsoluteTime) (time)) != NOSTART_ABSTIME)) - -#define RelativeTimeIsValid(time) \ - ((bool) (((RelativeTime) (time)) != INVALID_RELTIME)) - - -/* non-fmgr-callable support routines */ -extern AbsoluteTime GetCurrentAbsoluteTime(void); -extern void abstime2tm(AbsoluteTime time, int *tzp, struct pg_tm *tm, char **tzn); - -#endif /* NABSTIME_H */ diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index 8569ca55df..ff244498da 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -222,12 +222,6 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), FLOAT8OID, ECPG_ARRAY_NONE, stmt->lineno)) return ECPG_ARRAY_ERROR; - if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), ABSTIMEOID, ECPG_ARRAY_NONE, stmt->lineno)) - return ECPG_ARRAY_ERROR; - if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), RELTIMEOID, ECPG_ARRAY_NONE, stmt->lineno)) - return ECPG_ARRAY_ERROR; - if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TINTERVALOID, ECPG_ARRAY_NONE, stmt->lineno)) - return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), UNKNOWNOID, ECPG_ARRAY_NONE, stmt->lineno)) return ECPG_ARRAY_ERROR; if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIRCLEOID, ECPG_ARRAY_NONE, stmt->lineno)) diff --git a/src/test/regress/expected/abstime.out b/src/test/regress/expected/abstime.out deleted file mode 100644 index ed48f642ab..0000000000 --- a/src/test/regress/expected/abstime.out +++ /dev/null @@ -1,136 +0,0 @@ --- --- ABSTIME --- testing built-in time type abstime --- uses reltime and tinterval --- --- --- timezones may vary based not only on location but the operating --- system. the main correctness issue is that the OS may not get --- daylight savings time right for times prior to Unix epoch (jan 1 1970). --- -CREATE TABLE ABSTIME_TBL (f1 abstime); -BEGIN; -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'now'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'now'); -SELECT count(*) AS two FROM ABSTIME_TBL WHERE f1 = 'now' ; - two ------ - 2 -(1 row) - -END; -DELETE FROM ABSTIME_TBL; -INSERT INTO ABSTIME_TBL (f1) VALUES ('Jan 14, 1973 03:14:21'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'Mon May 1 00:30:30 1995'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'epoch'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'infinity'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime '-infinity'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'May 10, 1947 23:59:12'); --- what happens if we specify slightly misformatted abstime? -INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00'); -ERROR: date/time field value out of range: "Feb 35, 1946 10:00:00" -LINE 1: INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00'... - ^ -HINT: Perhaps you need a different "datestyle" setting. -INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10'); -ERROR: date/time field value out of range: "Feb 28, 1984 25:08:10" -LINE 1: INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10'... - ^ --- badly formatted abstimes: these should result in invalid abstimes -INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format'); -ERROR: invalid input syntax for type abstime: "bad date format" -LINE 1: INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format'); - ^ -INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843'); --- test abstime operators -SELECT '' AS eight, * FROM ABSTIME_TBL; - eight | f1 --------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST - | infinity - | -infinity - | Sat May 10 23:59:12 1947 PST - | invalid -(7 rows) - -SELECT '' AS six, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 < abstime 'Jun 30, 2001'; - six | f1 ------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST - | -infinity - | Sat May 10 23:59:12 1947 PST -(5 rows) - -SELECT '' AS six, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 > abstime '-infinity'; - six | f1 ------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST - | infinity - | Sat May 10 23:59:12 1947 PST - | invalid -(6 rows) - -SELECT '' AS six, * FROM ABSTIME_TBL - WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1; - six | f1 ------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST - | infinity - | -infinity - | invalid -(6 rows) - -SELECT '' AS three, * FROM ABSTIME_TBL - WHERE abstime 'epoch' >= ABSTIME_TBL.f1; - three | f1 --------+------------------------------ - | Wed Dec 31 16:00:00 1969 PST - | -infinity - | Sat May 10 23:59:12 1947 PST -(3 rows) - -SELECT '' AS four, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 <= abstime 'Jan 14, 1973 03:14:21'; - four | f1 -------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Wed Dec 31 16:00:00 1969 PST - | -infinity - | Sat May 10 23:59:12 1947 PST -(4 rows) - -SELECT '' AS four, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 - tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]'; - four | f1 -------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST -(3 rows) - -SELECT '' AS four, f1 AS abstime, - date_part('year', f1) AS year, date_part('month', f1) AS month, - date_part('day',f1) AS day, date_part('hour', f1) AS hour, - date_part('minute', f1) AS minute, date_part('second', f1) AS second - FROM ABSTIME_TBL - WHERE isfinite(f1) - ORDER BY abstime; - four | abstime | year | month | day | hour | minute | second -------+------------------------------+------+-------+-----+------+--------+-------- - | Sat May 10 23:59:12 1947 PST | 1947 | 5 | 10 | 23 | 59 | 12 - | Wed Dec 31 16:00:00 1969 PST | 1969 | 12 | 31 | 16 | 0 | 0 - | Sun Jan 14 03:14:21 1973 PST | 1973 | 1 | 14 | 3 | 14 | 21 - | Mon May 01 00:30:30 1995 PDT | 1995 | 5 | 1 | 0 | 30 | 30 -(4 rows) - diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index be0b54cc52..68cd3e5676 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -23,9 +23,7 @@ ALTER TABLE attmp ADD COLUMN d float8; ALTER TABLE attmp ADD COLUMN e float4; ALTER TABLE attmp ADD COLUMN f int2; ALTER TABLE attmp ADD COLUMN g polygon; -ALTER TABLE attmp ADD COLUMN h abstime; ALTER TABLE attmp ADD COLUMN i char; -ALTER TABLE attmp ADD COLUMN j abstime[]; ALTER TABLE attmp ADD COLUMN k int4; ALTER TABLE attmp ADD COLUMN l tid; ALTER TABLE attmp ADD COLUMN m xid; @@ -36,24 +34,23 @@ ALTER TABLE attmp ADD COLUMN q point; ALTER TABLE attmp ADD COLUMN r lseg; ALTER TABLE attmp ADD COLUMN s path; ALTER TABLE attmp ADD COLUMN t box; -ALTER TABLE attmp ADD COLUMN u tinterval; ALTER TABLE attmp ADD COLUMN v timestamp; ALTER TABLE attmp ADD COLUMN w interval; ALTER TABLE attmp ADD COLUMN x float8[]; ALTER TABLE attmp ADD COLUMN y float4[]; ALTER TABLE attmp ADD COLUMN z int2[]; -INSERT INTO attmp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, +INSERT INTO attmp (a, b, c, d, e, f, g, i, k, l, m, n, p, q, r, s, t, v, w, x, y, z) VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)', - 'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}', + 'c', 314159, '(1,1)', '512', '1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)', - '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', '["epoch" "infinity"]', + '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', 'epoch', '01:00:10', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}'); SELECT * FROM attmp; - initial | a | b | c | d | e | f | g | h | i | j | k | l | m | n | p | q | r | s | t | u | v | w | x | y | z ----------+---+------+------+-----+-----+---+-----------------------+------------------------------+---+------------------------------------------------------------------------------------------------+--------+-------+-----+-----------------+---------------+-----------+-----------------------+-----------------------------+---------------------+---------------------------------------------+--------------------------+------------------+-----------+-----------+----------- - | 4 | name | text | 4.1 | 4.1 | 2 | ((4.1,4.1),(3.1,3.1)) | Mon May 01 00:30:30 1995 PDT | c | {"Mon May 01 00:30:30 1995 PDT","Mon Aug 24 14:43:07 1992 PDT","Wed Dec 31 16:00:00 1969 PST"} | 314159 | (1,1) | 512 | 1 2 3 4 5 6 7 8 | magnetic disk | (1.1,1.1) | [(4.1,4.1),(3.1,3.1)] | ((0,2),(4.1,4.1),(3.1,3.1)) | (4.1,4.1),(3.1,3.1) | ["Wed Dec 31 16:00:00 1969 PST" "infinity"] | Thu Jan 01 00:00:00 1970 | @ 1 hour 10 secs | {1,2,3,4} | {1,2,3,4} | {1,2,3,4} + initial | a | b | c | d | e | f | g | i | k | l | m | n | p | q | r | s | t | v | w | x | y | z +---------+---+------+------+-----+-----+---+-----------------------+---+--------+-------+-----+-----------------+---------------+-----------+-----------------------+-----------------------------+---------------------+--------------------------+------------------+-----------+-----------+----------- + | 4 | name | text | 4.1 | 4.1 | 2 | ((4.1,4.1),(3.1,3.1)) | c | 314159 | (1,1) | 512 | 1 2 3 4 5 6 7 8 | magnetic disk | (1.1,1.1) | [(4.1,4.1),(3.1,3.1)] | ((0,2),(4.1,4.1),(3.1,3.1)) | (4.1,4.1),(3.1,3.1) | Thu Jan 01 00:00:00 1970 | @ 1 hour 10 secs | {1,2,3,4} | {1,2,3,4} | {1,2,3,4} (1 row) DROP TABLE attmp; @@ -68,9 +65,7 @@ ALTER TABLE attmp ADD COLUMN d float8; ALTER TABLE attmp ADD COLUMN e float4; ALTER TABLE attmp ADD COLUMN f int2; ALTER TABLE attmp ADD COLUMN g polygon; -ALTER TABLE attmp ADD COLUMN h abstime; ALTER TABLE attmp ADD COLUMN i char; -ALTER TABLE attmp ADD COLUMN j abstime[]; ALTER TABLE attmp ADD COLUMN k int4; ALTER TABLE attmp ADD COLUMN l tid; ALTER TABLE attmp ADD COLUMN m xid; @@ -81,24 +76,23 @@ ALTER TABLE attmp ADD COLUMN q point; ALTER TABLE attmp ADD COLUMN r lseg; ALTER TABLE attmp ADD COLUMN s path; ALTER TABLE attmp ADD COLUMN t box; -ALTER TABLE attmp ADD COLUMN u tinterval; ALTER TABLE attmp ADD COLUMN v timestamp; ALTER TABLE attmp ADD COLUMN w interval; ALTER TABLE attmp ADD COLUMN x float8[]; ALTER TABLE attmp ADD COLUMN y float4[]; ALTER TABLE attmp ADD COLUMN z int2[]; -INSERT INTO attmp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, +INSERT INTO attmp (a, b, c, d, e, f, g, i, k, l, m, n, p, q, r, s, t, v, w, x, y, z) VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)', - 'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}', + 'c', 314159, '(1,1)', '512', '1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)', - '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', '["epoch" "infinity"]', + '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', 'epoch', '01:00:10', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}'); SELECT * FROM attmp; - initial | a | b | c | d | e | f | g | h | i | j | k | l | m | n | p | q | r | s | t | u | v | w | x | y | z ----------+---+------+------+-----+-----+---+-----------------------+------------------------------+---+------------------------------------------------------------------------------------------------+--------+-------+-----+-----------------+---------------+-----------+-----------------------+-----------------------------+---------------------+---------------------------------------------+--------------------------+------------------+-----------+-----------+----------- - | 4 | name | text | 4.1 | 4.1 | 2 | ((4.1,4.1),(3.1,3.1)) | Mon May 01 00:30:30 1995 PDT | c | {"Mon May 01 00:30:30 1995 PDT","Mon Aug 24 14:43:07 1992 PDT","Wed Dec 31 16:00:00 1969 PST"} | 314159 | (1,1) | 512 | 1 2 3 4 5 6 7 8 | magnetic disk | (1.1,1.1) | [(4.1,4.1),(3.1,3.1)] | ((0,2),(4.1,4.1),(3.1,3.1)) | (4.1,4.1),(3.1,3.1) | ["Wed Dec 31 16:00:00 1969 PST" "infinity"] | Thu Jan 01 00:00:00 1970 | @ 1 hour 10 secs | {1,2,3,4} | {1,2,3,4} | {1,2,3,4} + initial | a | b | c | d | e | f | g | i | k | l | m | n | p | q | r | s | t | v | w | x | y | z +---------+---+------+------+-----+-----+---+-----------------------+---+--------+-------+-----+-----------------+---------------+-----------+-----------------------+-----------------------------+---------------------+--------------------------+------------------+-----------+-----------+----------- + | 4 | name | text | 4.1 | 4.1 | 2 | ((4.1,4.1),(3.1,3.1)) | c | 314159 | (1,1) | 512 | 1 2 3 4 5 6 7 8 | magnetic disk | (1.1,1.1) | [(4.1,4.1),(3.1,3.1)] | ((0,2),(4.1,4.1),(3.1,3.1)) | (4.1,4.1),(3.1,3.1) | Thu Jan 01 00:00:00 1970 | @ 1 hour 10 secs | {1,2,3,4} | {1,2,3,4} | {1,2,3,4} (1 row) CREATE INDEX attmp_idx ON attmp (a, (d + e), b); diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out index b00ab0f142..b2b4577333 100644 --- a/src/test/regress/expected/horology.out +++ b/src/test/regress/expected/horology.out @@ -2046,70 +2046,6 @@ SELECT '' AS "226", d1.f1 AS timestamp1, d2.f1 AS timestamp2, d1.f1 - d2.f1 AS d | Sat Sep 22 18:19:20 2001 PDT | Sat Sep 22 18:19:20 2001 PDT | @ 0 (256 rows) --- --- abstime, reltime arithmetic --- -SELECT '' AS ten, ABSTIME_TBL.f1 AS abstime, RELTIME_TBL.f1 AS reltime - FROM ABSTIME_TBL, RELTIME_TBL - WHERE (ABSTIME_TBL.f1 + RELTIME_TBL.f1) < abstime 'Jan 14 14:00:00 1971' - ORDER BY abstime, reltime; - ten | abstime | reltime ------+------------------------------+--------------- - | Sat May 10 23:59:12 1947 PST | @ 14 secs ago - | Sat May 10 23:59:12 1947 PST | @ 1 min - | Sat May 10 23:59:12 1947 PST | @ 5 hours - | Sat May 10 23:59:12 1947 PST | @ 10 days - | Sat May 10 23:59:12 1947 PST | @ 3 mons - | Wed Dec 31 16:00:00 1969 PST | @ 14 secs ago - | Wed Dec 31 16:00:00 1969 PST | @ 1 min - | Wed Dec 31 16:00:00 1969 PST | @ 5 hours - | Wed Dec 31 16:00:00 1969 PST | @ 10 days - | Wed Dec 31 16:00:00 1969 PST | @ 3 mons -(10 rows) - --- these four queries should return the same answer --- the "infinity" and "-infinity" tuples in ABSTIME_TBL cannot be added and --- therefore, should not show up in the results. -SELECT '' AS three, * FROM ABSTIME_TBL - WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year') -- +3 years - < abstime 'Jan 14 14:00:00 1977'; - three | f1 --------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Wed Dec 31 16:00:00 1969 PST - | Sat May 10 23:59:12 1947 PST -(3 rows) - -SELECT '' AS three, * FROM ABSTIME_TBL - WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years - < abstime 'Jan 14 14:00:00 1971'; - three | f1 --------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Wed Dec 31 16:00:00 1969 PST - | Sat May 10 23:59:12 1947 PST -(3 rows) - -SELECT '' AS three, * FROM ABSTIME_TBL - WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years - < abstime 'Jan 14 14:00:00 1971'; - three | f1 --------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Wed Dec 31 16:00:00 1969 PST - | Sat May 10 23:59:12 1947 PST -(3 rows) - -SELECT '' AS three, * FROM ABSTIME_TBL - WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years - < abstime 'Jan 14 14:00:00 1977'; - three | f1 --------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Wed Dec 31 16:00:00 1969 PST - | Sat May 10 23:59:12 1947 PST -(3 rows) - -- -- Conversions -- @@ -2137,80 +2073,6 @@ SELECT '' AS "16", f1 AS "timestamp", date(f1) AS date | Sat Sep 22 18:19:20 2001 PDT | 09-22-2001 (16 rows) -SELECT '' AS "16", f1 AS "timestamp", abstime(f1) AS abstime - FROM TEMP_TIMESTAMP - ORDER BY abstime; - 16 | timestamp | abstime -----+------------------------------+------------------------------ - | Thu Jan 01 00:00:00 1970 PST | Thu Jan 01 00:00:00 1970 PST - | Wed Feb 28 17:32:01 1996 PST | Wed Feb 28 17:32:01 1996 PST - | Thu Feb 29 17:32:01 1996 PST | Thu Feb 29 17:32:01 1996 PST - | Fri Mar 01 17:32:01 1996 PST | Fri Mar 01 17:32:01 1996 PST - | Mon Dec 30 17:32:01 1996 PST | Mon Dec 30 17:32:01 1996 PST - | Tue Dec 31 17:32:01 1996 PST | Tue Dec 31 17:32:01 1996 PST - | Fri Dec 31 17:32:01 1999 PST | Fri Dec 31 17:32:01 1999 PST - | Sat Jan 01 17:32:01 2000 PST | Sat Jan 01 17:32:01 2000 PST - | Wed Mar 15 02:14:05 2000 PST | Wed Mar 15 02:14:05 2000 PST - | Wed Mar 15 03:14:04 2000 PST | Wed Mar 15 03:14:04 2000 PST - | Wed Mar 15 08:14:01 2000 PST | Wed Mar 15 08:14:01 2000 PST - | Wed Mar 15 12:14:03 2000 PST | Wed Mar 15 12:14:03 2000 PST - | Wed Mar 15 13:14:02 2000 PST | Wed Mar 15 13:14:02 2000 PST - | Sun Dec 31 17:32:01 2000 PST | Sun Dec 31 17:32:01 2000 PST - | Mon Jan 01 17:32:01 2001 PST | Mon Jan 01 17:32:01 2001 PST - | Sat Sep 22 18:19:20 2001 PDT | Sat Sep 22 18:19:20 2001 PDT -(16 rows) - -SELECT '' AS four, f1 AS abstime, date(f1) AS date - FROM ABSTIME_TBL - WHERE isfinite(f1) AND f1 <> abstime 'now' - ORDER BY date, abstime; - four | abstime | date -------+------------------------------+------------ - | Sat May 10 23:59:12 1947 PST | 05-10-1947 - | Wed Dec 31 16:00:00 1969 PST | 12-31-1969 - | Sun Jan 14 03:14:21 1973 PST | 01-14-1973 - | Mon May 01 00:30:30 1995 PDT | 05-01-1995 -(4 rows) - -SELECT '' AS two, d1 AS "timestamp", abstime(d1) AS abstime - FROM TIMESTAMP_TBL WHERE NOT isfinite(d1); - two | timestamp | abstime ------+-----------+----------- - | -infinity | -infinity - | infinity | infinity -(2 rows) - -SELECT '' AS three, f1 as abstime, cast(f1 as timestamp) AS "timestamp" - FROM ABSTIME_TBL WHERE NOT isfinite(f1); -ERROR: cannot convert abstime "invalid" to timestamp -SELECT '' AS ten, f1 AS interval, reltime(f1) AS reltime - FROM INTERVAL_TBL; - ten | interval | reltime ------+-------------------------------+------------------------------- - | @ 1 min | @ 1 min - | @ 5 hours | @ 5 hours - | @ 10 days | @ 10 days - | @ 34 years | @ 34 years - | @ 3 mons | @ 3 mons - | @ 14 secs ago | @ 14 secs ago - | @ 1 day 2 hours 3 mins 4 secs | @ 1 day 2 hours 3 mins 4 secs - | @ 6 years | @ 6 years - | @ 5 mons | @ 5 mons - | @ 5 mons 12 hours | @ 5 mons 12 hours -(10 rows) - -SELECT '' AS six, f1 as reltime, CAST(f1 AS interval) AS interval - FROM RELTIME_TBL; - six | reltime | interval ------+---------------+--------------- - | @ 1 min | @ 1 min - | @ 5 hours | @ 5 hours - | @ 10 days | @ 10 days - | @ 34 years | @ 34 years - | @ 3 mons | @ 3 mons - | @ 14 secs ago | @ 14 secs ago -(6 rows) - DROP TABLE TEMP_TIMESTAMP; -- -- Formats @@ -2292,18 +2154,6 @@ SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; | Mon Jan 01 17:32:01 2001 (65 rows) -SELECT '' AS seven, f1 AS us_postgres FROM ABSTIME_TBL; - seven | us_postgres --------+------------------------------ - | Sun Jan 14 03:14:21 1973 PST - | Mon May 01 00:30:30 1995 PDT - | Wed Dec 31 16:00:00 1969 PST - | infinity - | -infinity - | Sat May 10 23:59:12 1947 PST - | invalid -(7 rows) - SET DateStyle TO 'US,ISO'; SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL; 64 | us_iso @@ -2375,18 +2225,6 @@ SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL; | 2001-01-01 17:32:01 (65 rows) -SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; - seven | us_iso --------+------------------------ - | 1973-01-14 03:14:21-08 - | 1995-05-01 00:30:30-07 - | 1969-12-31 16:00:00-08 - | infinity - | -infinity - | 1947-05-10 23:59:12-08 - | invalid -(7 rows) - SET DateStyle TO 'US,SQL'; SHOW DateStyle; DateStyle @@ -2464,18 +2302,6 @@ SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; | 01/01/2001 17:32:01 (65 rows) -SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; - seven | us_sql --------+------------------------- - | 01/14/1973 03:14:21 PST - | 05/01/1995 00:30:30 PDT - | 12/31/1969 16:00:00 PST - | infinity - | -infinity - | 05/10/1947 23:59:12 PST - | invalid -(7 rows) - SET DateStyle TO 'European,Postgres'; SHOW DateStyle; DateStyle @@ -2561,18 +2387,6 @@ SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL; | Thu 13 Jun 00:00:00 1957 (66 rows) -SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; - seven | european_postgres --------+------------------------------ - | Sun 14 Jan 03:14:21 1973 PST - | Mon 01 May 00:30:30 1995 PDT - | Wed 31 Dec 16:00:00 1969 PST - | infinity - | -infinity - | Sat 10 May 23:59:12 1947 PST - | invalid -(7 rows) - SET DateStyle TO 'European,ISO'; SHOW DateStyle; DateStyle @@ -2651,18 +2465,6 @@ SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; | 1957-06-13 00:00:00 (66 rows) -SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; - seven | european_iso --------+------------------------ - | 1973-01-14 03:14:21-08 - | 1995-05-01 00:30:30-07 - | 1969-12-31 16:00:00-08 - | infinity - | -infinity - | 1947-05-10 23:59:12-08 - | invalid -(7 rows) - SET DateStyle TO 'European,SQL'; SHOW DateStyle; DateStyle @@ -2741,18 +2543,6 @@ SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; | 13/06/1957 00:00:00 (66 rows) -SELECT '' AS seven, f1 AS european_sql FROM ABSTIME_TBL; - seven | european_sql --------+------------------------- - | 14/01/1973 03:14:21 PST - | 01/05/1995 00:30:30 PDT - | 31/12/1969 16:00:00 PST - | infinity - | -infinity - | 10/05/1947 23:59:12 PST - | invalid -(7 rows) - RESET DateStyle; -- -- to_timestamp() diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out index 7bcc03b9ad..11e6cd8571 100644 --- a/src/test/regress/expected/opr_sanity.out +++ b/src/test/regress/expected/opr_sanity.out @@ -521,24 +521,6 @@ int24ge(smallint,integer) int42ge(integer,smallint) oideq(oid,oid) oidne(oid,oid) -abstimeeq(abstime,abstime) -abstimene(abstime,abstime) -abstimelt(abstime,abstime) -abstimegt(abstime,abstime) -abstimele(abstime,abstime) -abstimege(abstime,abstime) -reltimeeq(reltime,reltime) -reltimene(reltime,reltime) -reltimelt(reltime,reltime) -reltimegt(reltime,reltime) -reltimele(reltime,reltime) -reltimege(reltime,reltime) -tintervalleneq(tinterval,reltime) -tintervallenne(tinterval,reltime) -tintervallenlt(tinterval,reltime) -tintervallengt(tinterval,reltime) -tintervallenle(tinterval,reltime) -tintervallenge(tinterval,reltime) float4eq(real,real) float4ne(real,real) float4lt(real,real) @@ -568,12 +550,9 @@ btint4cmp(integer,integer) btfloat4cmp(real,real) btfloat8cmp(double precision,double precision) btoidcmp(oid,oid) -btabstimecmp(abstime,abstime) btcharcmp("char","char") btnamecmp(name,name) cash_cmp(money,money) -btreltimecmp(reltime,reltime) -bttintervalcmp(tinterval,tinterval) int8eq(bigint,bigint) int8ne(bigint,bigint) int8lt(bigint,bigint) @@ -593,12 +572,6 @@ namege(name,name) namene(name,name) oidlt(oid,oid) oidle(oid,oid) -tintervaleq(tinterval,tinterval) -tintervalne(tinterval,tinterval) -tintervallt(tinterval,tinterval) -tintervalgt(tinterval,tinterval) -tintervalle(tinterval,tinterval) -tintervalge(tinterval,tinterval) macaddr_eq(macaddr,macaddr) macaddr_lt(macaddr,macaddr) macaddr_le(macaddr,macaddr) @@ -1074,9 +1047,6 @@ ORDER BY 1, 2; !~* | ~* !~~ | ~~ !~~* | ~~* - #< | #>= - #<= | #> - #<> | #= *< | *>= *<= | *> *<> | *= @@ -1086,7 +1056,7 @@ ORDER BY 1, 2; <> | ~= ~<=~ | ~>~ ~<~ | ~>=~ -(16 rows) +(13 rows) -- A mergejoinable or hashjoinable operator must be binary, must return -- boolean, and must have a commutator (itself, unless it's a cross-type @@ -1354,7 +1324,6 @@ WHERE a.aggfnoid = p.oid AND -- Cross-check transfn against its entry in pg_proc. -- NOTE: use physically_coercible here, not binary_coercible, because --- max and min on abstime are implemented using int4larger/int4smaller. SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.proname FROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptr WHERE a.aggfnoid = p.oid AND @@ -1535,7 +1504,6 @@ WHERE a.aggfnoid = p.oid AND -- Check that all combine functions have signature -- combine(transtype, transtype) returns transtype -- NOTE: use physically_coercible here, not binary_coercible, because --- max and min on abstime are implemented using int4larger/int4smaller. SELECT a.aggfnoid, p.proname FROM pg_aggregate as a, pg_proc as p WHERE a.aggcombinefn = p.oid AND diff --git a/src/test/regress/expected/reltime.out b/src/test/regress/expected/reltime.out deleted file mode 100644 index 14fdc6aeec..0000000000 --- a/src/test/regress/expected/reltime.out +++ /dev/null @@ -1,109 +0,0 @@ --- --- RELTIME --- -CREATE TABLE RELTIME_TBL (f1 reltime); -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 1 minute'); -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 5 hour'); -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 10 day'); -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 34 year'); -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 3 months'); -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 14 seconds ago'); --- badly formatted reltimes -INSERT INTO RELTIME_TBL (f1) VALUES ('badly formatted reltime'); -ERROR: invalid input syntax for type reltime: "badly formatted reltime" -LINE 1: INSERT INTO RELTIME_TBL (f1) VALUES ('badly formatted reltim... - ^ -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago'); -ERROR: invalid input syntax for type reltime: "@ 30 eons ago" -LINE 1: INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago'); - ^ --- test reltime operators -SELECT '' AS six, * FROM RELTIME_TBL; - six | f1 ------+--------------- - | @ 1 min - | @ 5 hours - | @ 10 days - | @ 34 years - | @ 3 mons - | @ 14 secs ago -(6 rows) - -SELECT '' AS five, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 <> reltime '@ 10 days'; - five | f1 -------+--------------- - | @ 1 min - | @ 5 hours - | @ 34 years - | @ 3 mons - | @ 14 secs ago -(5 rows) - -SELECT '' AS three, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 <= reltime '@ 5 hours'; - three | f1 --------+--------------- - | @ 1 min - | @ 5 hours - | @ 14 secs ago -(3 rows) - -SELECT '' AS three, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 < reltime '@ 1 day'; - three | f1 --------+--------------- - | @ 1 min - | @ 5 hours - | @ 14 secs ago -(3 rows) - -SELECT '' AS one, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 = reltime '@ 34 years'; - one | f1 ------+------------ - | @ 34 years -(1 row) - -SELECT '' AS two, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 >= reltime '@ 1 month'; - two | f1 ------+------------ - | @ 34 years - | @ 3 mons -(2 rows) - -SELECT '' AS five, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 > reltime '@ 3 seconds ago'; - five | f1 -------+------------ - | @ 1 min - | @ 5 hours - | @ 10 days - | @ 34 years - | @ 3 mons -(5 rows) - -SELECT '' AS fifteen, r1.*, r2.* - FROM RELTIME_TBL r1, RELTIME_TBL r2 - WHERE r1.f1 > r2.f1 - ORDER BY r1.f1, r2.f1; - fifteen | f1 | f1 ----------+------------+--------------- - | @ 1 min | @ 14 secs ago - | @ 5 hours | @ 14 secs ago - | @ 5 hours | @ 1 min - | @ 10 days | @ 14 secs ago - | @ 10 days | @ 1 min - | @ 10 days | @ 5 hours - | @ 3 mons | @ 14 secs ago - | @ 3 mons | @ 1 min - | @ 3 mons | @ 5 hours - | @ 3 mons | @ 10 days - | @ 34 years | @ 14 secs ago - | @ 34 years | @ 1 min - | @ 34 years | @ 5 hours - | @ 34 years | @ 10 days - | @ 34 years | @ 3 mons -(15 rows) - diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index 078129f251..735dd37acf 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -1706,7 +1706,7 @@ pg_shadow| SELECT pg_authid.rolname AS usename, pg_authid.rolreplication AS userepl, pg_authid.rolbypassrls AS usebypassrls, pg_authid.rolpassword AS passwd, - (pg_authid.rolvaliduntil)::abstime AS valuntil, + pg_authid.rolvaliduntil AS valuntil, s.setconfig AS useconfig FROM (pg_authid LEFT JOIN pg_db_role_setting s ON (((pg_authid.oid = s.setrole) AND (s.setdatabase = (0)::oid)))) diff --git a/src/test/regress/expected/sanity_check.out b/src/test/regress/expected/sanity_check.out index 48e0508a96..9c7a60c092 100644 --- a/src/test/regress/expected/sanity_check.out +++ b/src/test/regress/expected/sanity_check.out @@ -13,7 +13,6 @@ SELECT relname, relhasindex ORDER BY relname; a|f a_star|f -abstime_tbl|f aggtest|f array_index_op_test|t array_op_test|f @@ -174,7 +173,6 @@ quad_poly_tbl_ord_seq2|f radix_text_tbl|t ramp|f real_city|f -reltime_tbl|f road|t shighway|t slow_emp4000|f @@ -205,7 +203,6 @@ time_tbl|f timestamp_tbl|f timestamptz_tbl|f timetz_tbl|f -tinterval_tbl|f varchar_tbl|f -- restore normal output mode \a\t diff --git a/src/test/regress/expected/tinterval.out b/src/test/regress/expected/tinterval.out deleted file mode 100644 index a0189729fc..0000000000 --- a/src/test/regress/expected/tinterval.out +++ /dev/null @@ -1,172 +0,0 @@ --- --- TINTERVAL --- -CREATE TABLE TINTERVAL_TBL (f1 tinterval); --- Should accept any abstime, --- so do not bother with extensive testing of values -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["-infinity" "infinity"]'); -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["May 10, 1947 23:59:12" "Jan 14, 1973 03:14:21"]'); -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["Sep 4, 1983 23:59:12" "Oct 4, 1983 23:59:12"]'); -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["epoch" "Mon May 1 00:30:30 1995"]'); -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["Feb 15 1990 12:15:03" "2001-09-23 11:12:13"]'); --- badly formatted tintervals -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["bad time specifications" ""]'); -ERROR: invalid input syntax for type abstime: "bad time specifications" -LINE 2: VALUES ('["bad time specifications" ""]'); - ^ -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["" "infinity"]'); -ERROR: invalid input syntax for type abstime: "" -LINE 2: VALUES ('["" "infinity"]'); - ^ --- test tinterval operators -SELECT '' AS five, * FROM TINTERVAL_TBL; - five | f1 -------+----------------------------------------------------------------- - | ["-infinity" "infinity"] - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] - | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] - | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] -(5 rows) - --- length == -SELECT '' AS one, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #= '@ 1 months'; - one | f1 ------+----------------------------------------------------------------- - | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] -(1 row) - --- length <> -SELECT '' AS three, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #<> '@ 1 months'; - three | f1 --------+----------------------------------------------------------------- - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] - | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] -(3 rows) - --- length < -SELECT '' AS zero, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #< '@ 1 month'; - zero | f1 -------+---- -(0 rows) - --- length <= -SELECT '' AS one, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #<= '@ 1 month'; - one | f1 ------+----------------------------------------------------------------- - | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] -(1 row) - --- length > -SELECT '' AS three, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #> '@ 1 year'; - three | f1 --------+----------------------------------------------------------------- - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] - | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] -(3 rows) - --- length >= -SELECT '' AS three, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #>= '@ 3 years'; - three | f1 --------+----------------------------------------------------------------- - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] - | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] -(3 rows) - --- overlaps -SELECT '' AS three, t1.* - FROM TINTERVAL_TBL t1 - WHERE t1.f1 && - tinterval '["Aug 15 14:23:19 1983" "Sep 16 14:23:19 1983"]'; - three | f1 --------+----------------------------------------------------------------- - | ["-infinity" "infinity"] - | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] -(3 rows) - -SELECT '' AS five, t1.f1, t2.f1 - FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2 - WHERE t1.f1 && t2.f1 and - t1.f1 = t2.f1 - ORDER BY t1.f1, t2.f1; - five | f1 | f1 -------+-----------------------------------------------------------------+----------------------------------------------------------------- - | ["-infinity" "infinity"] | ["-infinity" "infinity"] - | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] - | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] -(5 rows) - -SELECT '' AS fourteen, t1.f1 AS interval1, t2.f1 AS interval2 - FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2 - WHERE t1.f1 && t2.f1 and not t1.f1 = t2.f1 - ORDER BY interval1, interval2; - fourteen | interval1 | interval2 -----------+-----------------------------------------------------------------+----------------------------------------------------------------- - | ["-infinity" "infinity"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] - | ["-infinity" "infinity"] | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] - | ["-infinity" "infinity"] | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] - | ["-infinity" "infinity"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] - | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["-infinity" "infinity"] - | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] - | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] | ["-infinity" "infinity"] - | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["-infinity" "infinity"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["-infinity" "infinity"] - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] -(14 rows) - --- contains -SELECT '' AS five, t1.f1 - FROM TINTERVAL_TBL t1 - WHERE not t1.f1 << - tinterval '["Aug 15 14:23:19 1980" "Sep 16 14:23:19 1990"]' - ORDER BY t1.f1; - five | f1 -------+----------------------------------------------------------------- - | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] - | ["Thu Feb 15 12:15:03 1990 PST" "Sun Sep 23 11:12:13 2001 PDT"] - | ["Sat May 10 23:59:12 1947 PST" "Sun Jan 14 03:14:21 1973 PST"] -(3 rows) - --- make time interval -SELECT '' AS three, t1.f1 - FROM TINTERVAL_TBL t1 - WHERE t1.f1 && - (abstime 'Aug 15 14:23:19 1983' <#> - abstime 'Sep 16 14:23:19 1983') - ORDER BY t1.f1; - three | f1 --------+----------------------------------------------------------------- - | ["-infinity" "infinity"] - | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] - | ["Wed Dec 31 16:00:00 1969 PST" "Mon May 01 00:30:30 1995 PDT"] -(3 rows) - diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule index 16f979c8d9..8f07343c1a 100644 --- a/src/test/regress/parallel_schedule +++ b/src/test/regress/parallel_schedule @@ -23,12 +23,12 @@ test: numerology # ---------- # The second group of parallel tests # ---------- -test: point lseg line box path polygon circle date time timetz timestamp timestamptz interval abstime reltime tinterval inet macaddr macaddr8 tstypes +test: point lseg line box path polygon circle date time timetz timestamp timestamptz interval inet macaddr macaddr8 tstypes # ---------- # Another group of parallel tests # geometry depends on point, lseg, box, path, polygon and circle -# horology depends on interval, timetz, timestamp, timestamptz, reltime and abstime +# horology depends on interval, timetz, timestamp, timestamptz # ---------- test: geometry horology regex oidjoins type_sanity opr_sanity misc_sanity comments expressions diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule index 42632be675..265e2cda50 100644 --- a/src/test/regress/serial_schedule +++ b/src/test/regress/serial_schedule @@ -36,9 +36,6 @@ test: timetz test: timestamp test: timestamptz test: interval -test: abstime -test: reltime -test: tinterval test: inet test: macaddr test: macaddr8 diff --git a/src/test/regress/sql/abstime.sql b/src/test/regress/sql/abstime.sql deleted file mode 100644 index 4ab821b1b8..0000000000 --- a/src/test/regress/sql/abstime.sql +++ /dev/null @@ -1,67 +0,0 @@ --- --- ABSTIME --- testing built-in time type abstime --- uses reltime and tinterval --- - --- --- timezones may vary based not only on location but the operating --- system. the main correctness issue is that the OS may not get --- daylight savings time right for times prior to Unix epoch (jan 1 1970). --- - -CREATE TABLE ABSTIME_TBL (f1 abstime); - -BEGIN; -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'now'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'now'); -SELECT count(*) AS two FROM ABSTIME_TBL WHERE f1 = 'now' ; -END; - -DELETE FROM ABSTIME_TBL; - -INSERT INTO ABSTIME_TBL (f1) VALUES ('Jan 14, 1973 03:14:21'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'Mon May 1 00:30:30 1995'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'epoch'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'infinity'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime '-infinity'); -INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'May 10, 1947 23:59:12'); - --- what happens if we specify slightly misformatted abstime? -INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00'); -INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10'); - --- badly formatted abstimes: these should result in invalid abstimes -INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format'); -INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843'); - --- test abstime operators - -SELECT '' AS eight, * FROM ABSTIME_TBL; - -SELECT '' AS six, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 < abstime 'Jun 30, 2001'; - -SELECT '' AS six, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 > abstime '-infinity'; - -SELECT '' AS six, * FROM ABSTIME_TBL - WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1; - -SELECT '' AS three, * FROM ABSTIME_TBL - WHERE abstime 'epoch' >= ABSTIME_TBL.f1; - -SELECT '' AS four, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 <= abstime 'Jan 14, 1973 03:14:21'; - -SELECT '' AS four, * FROM ABSTIME_TBL - WHERE ABSTIME_TBL.f1 - tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]'; - -SELECT '' AS four, f1 AS abstime, - date_part('year', f1) AS year, date_part('month', f1) AS month, - date_part('day',f1) AS day, date_part('hour', f1) AS hour, - date_part('minute', f1) AS minute, date_part('second', f1) AS second - FROM ABSTIME_TBL - WHERE isfinite(f1) - ORDER BY abstime; diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index 179bbfb9a1..6890346637 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -35,12 +35,8 @@ ALTER TABLE attmp ADD COLUMN f int2; ALTER TABLE attmp ADD COLUMN g polygon; -ALTER TABLE attmp ADD COLUMN h abstime; - ALTER TABLE attmp ADD COLUMN i char; -ALTER TABLE attmp ADD COLUMN j abstime[]; - ALTER TABLE attmp ADD COLUMN k int4; ALTER TABLE attmp ADD COLUMN l tid; @@ -60,8 +56,6 @@ ALTER TABLE attmp ADD COLUMN s path; ALTER TABLE attmp ADD COLUMN t box; -ALTER TABLE attmp ADD COLUMN u tinterval; - ALTER TABLE attmp ADD COLUMN v timestamp; ALTER TABLE attmp ADD COLUMN w interval; @@ -72,13 +66,13 @@ ALTER TABLE attmp ADD COLUMN y float4[]; ALTER TABLE attmp ADD COLUMN z int2[]; -INSERT INTO attmp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, +INSERT INTO attmp (a, b, c, d, e, f, g, i, k, l, m, n, p, q, r, s, t, v, w, x, y, z) VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)', - 'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}', + 'c', 314159, '(1,1)', '512', '1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)', - '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', '["epoch" "infinity"]', + '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', 'epoch', '01:00:10', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}'); SELECT * FROM attmp; @@ -104,12 +98,8 @@ ALTER TABLE attmp ADD COLUMN f int2; ALTER TABLE attmp ADD COLUMN g polygon; -ALTER TABLE attmp ADD COLUMN h abstime; - ALTER TABLE attmp ADD COLUMN i char; -ALTER TABLE attmp ADD COLUMN j abstime[]; - ALTER TABLE attmp ADD COLUMN k int4; ALTER TABLE attmp ADD COLUMN l tid; @@ -129,8 +119,6 @@ ALTER TABLE attmp ADD COLUMN s path; ALTER TABLE attmp ADD COLUMN t box; -ALTER TABLE attmp ADD COLUMN u tinterval; - ALTER TABLE attmp ADD COLUMN v timestamp; ALTER TABLE attmp ADD COLUMN w interval; @@ -141,13 +129,13 @@ ALTER TABLE attmp ADD COLUMN y float4[]; ALTER TABLE attmp ADD COLUMN z int2[]; -INSERT INTO attmp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u, +INSERT INTO attmp (a, b, c, d, e, f, g, i, k, l, m, n, p, q, r, s, t, v, w, x, y, z) VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)', - 'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}', + 'c', 314159, '(1,1)', '512', '1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)', - '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', '["epoch" "infinity"]', + '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', 'epoch', '01:00:10', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}'); SELECT * FROM attmp; diff --git a/src/test/regress/sql/horology.sql b/src/test/regress/sql/horology.sql index ca34e8753d..e356dd563e 100644 --- a/src/test/regress/sql/horology.sql +++ b/src/test/regress/sql/horology.sql @@ -267,35 +267,6 @@ SELECT '' AS "226", d1.f1 AS timestamp1, d2.f1 AS timestamp2, d1.f1 - d2.f1 AS d FROM TEMP_TIMESTAMP d1, TEMP_TIMESTAMP d2 ORDER BY timestamp1, timestamp2, difference; --- --- abstime, reltime arithmetic --- - -SELECT '' AS ten, ABSTIME_TBL.f1 AS abstime, RELTIME_TBL.f1 AS reltime - FROM ABSTIME_TBL, RELTIME_TBL - WHERE (ABSTIME_TBL.f1 + RELTIME_TBL.f1) < abstime 'Jan 14 14:00:00 1971' - ORDER BY abstime, reltime; - --- these four queries should return the same answer --- the "infinity" and "-infinity" tuples in ABSTIME_TBL cannot be added and --- therefore, should not show up in the results. - -SELECT '' AS three, * FROM ABSTIME_TBL - WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year') -- +3 years - < abstime 'Jan 14 14:00:00 1977'; - -SELECT '' AS three, * FROM ABSTIME_TBL - WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years - < abstime 'Jan 14 14:00:00 1971'; - -SELECT '' AS three, * FROM ABSTIME_TBL - WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years - < abstime 'Jan 14 14:00:00 1971'; - -SELECT '' AS three, * FROM ABSTIME_TBL - WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years - < abstime 'Jan 14 14:00:00 1977'; - -- -- Conversions -- @@ -305,27 +276,6 @@ SELECT '' AS "16", f1 AS "timestamp", date(f1) AS date WHERE f1 <> timestamp 'now' ORDER BY date, "timestamp"; -SELECT '' AS "16", f1 AS "timestamp", abstime(f1) AS abstime - FROM TEMP_TIMESTAMP - ORDER BY abstime; - -SELECT '' AS four, f1 AS abstime, date(f1) AS date - FROM ABSTIME_TBL - WHERE isfinite(f1) AND f1 <> abstime 'now' - ORDER BY date, abstime; - -SELECT '' AS two, d1 AS "timestamp", abstime(d1) AS abstime - FROM TIMESTAMP_TBL WHERE NOT isfinite(d1); - -SELECT '' AS three, f1 as abstime, cast(f1 as timestamp) AS "timestamp" - FROM ABSTIME_TBL WHERE NOT isfinite(f1); - -SELECT '' AS ten, f1 AS interval, reltime(f1) AS reltime - FROM INTERVAL_TBL; - -SELECT '' AS six, f1 as reltime, CAST(f1 AS interval) AS interval - FROM RELTIME_TBL; - DROP TABLE TEMP_TIMESTAMP; -- @@ -338,22 +288,16 @@ SHOW DateStyle; SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; -SELECT '' AS seven, f1 AS us_postgres FROM ABSTIME_TBL; - SET DateStyle TO 'US,ISO'; SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL; -SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; - SET DateStyle TO 'US,SQL'; SHOW DateStyle; SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; -SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; - SET DateStyle TO 'European,Postgres'; SHOW DateStyle; @@ -364,24 +308,18 @@ SELECT count(*) as one FROM TIMESTAMP_TBL WHERE d1 = 'Jun 13 1957'; SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL; -SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; - SET DateStyle TO 'European,ISO'; SHOW DateStyle; SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; -SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; - SET DateStyle TO 'European,SQL'; SHOW DateStyle; SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; -SELECT '' AS seven, f1 AS european_sql FROM ABSTIME_TBL; - RESET DateStyle; -- diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql index a593d37643..5bb365e9da 100644 --- a/src/test/regress/sql/opr_sanity.sql +++ b/src/test/regress/sql/opr_sanity.sql @@ -823,7 +823,6 @@ WHERE a.aggfnoid = p.oid AND -- Cross-check transfn against its entry in pg_proc. -- NOTE: use physically_coercible here, not binary_coercible, because --- max and min on abstime are implemented using int4larger/int4smaller. SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.proname FROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptr WHERE a.aggfnoid = p.oid AND @@ -978,7 +977,6 @@ WHERE a.aggfnoid = p.oid AND -- Check that all combine functions have signature -- combine(transtype, transtype) returns transtype -- NOTE: use physically_coercible here, not binary_coercible, because --- max and min on abstime are implemented using int4larger/int4smaller. SELECT a.aggfnoid, p.proname FROM pg_aggregate as a, pg_proc as p diff --git a/src/test/regress/sql/reltime.sql b/src/test/regress/sql/reltime.sql deleted file mode 100644 index a07b64e29d..0000000000 --- a/src/test/regress/sql/reltime.sql +++ /dev/null @@ -1,50 +0,0 @@ --- --- RELTIME --- - -CREATE TABLE RELTIME_TBL (f1 reltime); - -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 1 minute'); - -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 5 hour'); - -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 10 day'); - -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 34 year'); - -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 3 months'); - -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 14 seconds ago'); - - --- badly formatted reltimes -INSERT INTO RELTIME_TBL (f1) VALUES ('badly formatted reltime'); - -INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago'); - --- test reltime operators - -SELECT '' AS six, * FROM RELTIME_TBL; - -SELECT '' AS five, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 <> reltime '@ 10 days'; - -SELECT '' AS three, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 <= reltime '@ 5 hours'; - -SELECT '' AS three, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 < reltime '@ 1 day'; - -SELECT '' AS one, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 = reltime '@ 34 years'; - -SELECT '' AS two, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 >= reltime '@ 1 month'; - -SELECT '' AS five, * FROM RELTIME_TBL - WHERE RELTIME_TBL.f1 > reltime '@ 3 seconds ago'; - -SELECT '' AS fifteen, r1.*, r2.* - FROM RELTIME_TBL r1, RELTIME_TBL r2 - WHERE r1.f1 > r2.f1 - ORDER BY r1.f1, r2.f1; diff --git a/src/test/regress/sql/tinterval.sql b/src/test/regress/sql/tinterval.sql deleted file mode 100644 index 42399ce694..0000000000 --- a/src/test/regress/sql/tinterval.sql +++ /dev/null @@ -1,97 +0,0 @@ --- --- TINTERVAL --- - -CREATE TABLE TINTERVAL_TBL (f1 tinterval); - --- Should accept any abstime, --- so do not bother with extensive testing of values - -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["-infinity" "infinity"]'); - -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["May 10, 1947 23:59:12" "Jan 14, 1973 03:14:21"]'); - -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["Sep 4, 1983 23:59:12" "Oct 4, 1983 23:59:12"]'); - -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["epoch" "Mon May 1 00:30:30 1995"]'); - -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["Feb 15 1990 12:15:03" "2001-09-23 11:12:13"]'); - - --- badly formatted tintervals -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["bad time specifications" ""]'); - -INSERT INTO TINTERVAL_TBL (f1) - VALUES ('["" "infinity"]'); - --- test tinterval operators - -SELECT '' AS five, * FROM TINTERVAL_TBL; - --- length == -SELECT '' AS one, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #= '@ 1 months'; - --- length <> -SELECT '' AS three, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #<> '@ 1 months'; - --- length < -SELECT '' AS zero, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #< '@ 1 month'; - --- length <= -SELECT '' AS one, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #<= '@ 1 month'; - --- length > -SELECT '' AS three, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #> '@ 1 year'; - --- length >= -SELECT '' AS three, t.* - FROM TINTERVAL_TBL t - WHERE t.f1 #>= '@ 3 years'; - --- overlaps -SELECT '' AS three, t1.* - FROM TINTERVAL_TBL t1 - WHERE t1.f1 && - tinterval '["Aug 15 14:23:19 1983" "Sep 16 14:23:19 1983"]'; - -SELECT '' AS five, t1.f1, t2.f1 - FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2 - WHERE t1.f1 && t2.f1 and - t1.f1 = t2.f1 - ORDER BY t1.f1, t2.f1; - -SELECT '' AS fourteen, t1.f1 AS interval1, t2.f1 AS interval2 - FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2 - WHERE t1.f1 && t2.f1 and not t1.f1 = t2.f1 - ORDER BY interval1, interval2; - --- contains -SELECT '' AS five, t1.f1 - FROM TINTERVAL_TBL t1 - WHERE not t1.f1 << - tinterval '["Aug 15 14:23:19 1980" "Sep 16 14:23:19 1990"]' - ORDER BY t1.f1; - --- make time interval -SELECT '' AS three, t1.f1 - FROM TINTERVAL_TBL t1 - WHERE t1.f1 && - (abstime 'Aug 15 14:23:19 1983' <#> - abstime 'Sep 16 14:23:19 1983') - ORDER BY t1.f1; -- 2.40.0