mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
Revert temporal primary keys and foreign keys
This feature set did not handle empty ranges correctly, and it's now
too late for PostgreSQL 17 to fix it.
The following commits are reverted:
6db4598fcb Add stratnum GiST support function
46a0cd4cef Add temporal PRIMARY KEY and UNIQUE constraints
86232a49a4 Fix comment on gist_stratnum_btree
030e10ff1a Rename pg_constraint.conwithoutoverlaps to conperiod
a88c800deb Use daterange and YMD in without_overlaps tests instead of tsrange.
5577a71fb0 Use half-open interval notation in without_overlaps tests
34768ee361 Add temporal FOREIGN KEY contraints
482e108cd3 Add test for REPLICA IDENTITY with a temporal key
c3db1f30cb doc: clarify PERIOD and WITHOUT OVERLAPS in CREATE TABLE
144c2ce0cc Fix ON CONFLICT DO NOTHING/UPDATE for temporal indexes
Discussion: https://www.postgresql.org/message-id/d0b64a7a-dfe4-4b84-a906-c7dedfa40a3e@eisentraut.org
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include "common/pg_prng.h"
|
||||
#include "storage/indexfsm.h"
|
||||
#include "utils/float.h"
|
||||
#include "utils/fmgrprotos.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/rel.h"
|
||||
#include "utils/snapmgr.h"
|
||||
@@ -1056,45 +1055,3 @@ gistGetFakeLSN(Relation rel)
|
||||
return GetFakeLSNForUnloggedRel();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the same number that was received.
|
||||
*
|
||||
* This is for GiST opclasses that use the RT*StrategyNumber constants.
|
||||
*/
|
||||
Datum
|
||||
gist_stratnum_identity(PG_FUNCTION_ARGS)
|
||||
{
|
||||
StrategyNumber strat = PG_GETARG_UINT16(0);
|
||||
|
||||
PG_RETURN_UINT16(strat);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the opclass's private stratnum used for the given strategy.
|
||||
*
|
||||
* Calls the opclass's GIST_STRATNUM_PROC support function, if any,
|
||||
* and returns the result.
|
||||
* Returns InvalidStrategy if the function is not defined.
|
||||
*/
|
||||
StrategyNumber
|
||||
GistTranslateStratnum(Oid opclass, StrategyNumber strat)
|
||||
{
|
||||
Oid opfamily;
|
||||
Oid opcintype;
|
||||
Oid funcid;
|
||||
Datum result;
|
||||
|
||||
/* Look up the opclass family and input datatype. */
|
||||
if (!get_opclass_opfamily_and_input_type(opclass, &opfamily, &opcintype))
|
||||
return InvalidStrategy;
|
||||
|
||||
/* Check whether the function is provided. */
|
||||
funcid = get_opfamily_proc(opfamily, opcintype, opcintype, GIST_STRATNUM_PROC);
|
||||
if (!OidIsValid(funcid))
|
||||
return InvalidStrategy;
|
||||
|
||||
/* Ask the translation function */
|
||||
result = OidFunctionCall1Coll(funcid, InvalidOid, UInt16GetDatum(strat));
|
||||
return DatumGetUInt16(result);
|
||||
}
|
||||
|
||||
@@ -146,10 +146,6 @@ gistvalidate(Oid opclassoid)
|
||||
ok = check_amproc_signature(procform->amproc, VOIDOID, true,
|
||||
1, 1, INTERNALOID);
|
||||
break;
|
||||
case GIST_STRATNUM_PROC:
|
||||
ok = check_amproc_signature(procform->amproc, INT2OID, true,
|
||||
1, 1, INT2OID);
|
||||
break;
|
||||
default:
|
||||
ereport(INFO,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
@@ -270,8 +266,7 @@ gistvalidate(Oid opclassoid)
|
||||
continue; /* got it */
|
||||
if (i == GIST_DISTANCE_PROC || i == GIST_FETCH_PROC ||
|
||||
i == GIST_COMPRESS_PROC || i == GIST_DECOMPRESS_PROC ||
|
||||
i == GIST_OPTIONS_PROC || i == GIST_SORTSUPPORT_PROC ||
|
||||
i == GIST_STRATNUM_PROC)
|
||||
i == GIST_OPTIONS_PROC || i == GIST_SORTSUPPORT_PROC)
|
||||
continue; /* optional methods */
|
||||
ereport(INFO,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
@@ -343,7 +338,6 @@ gistadjustmembers(Oid opfamilyoid,
|
||||
case GIST_FETCH_PROC:
|
||||
case GIST_OPTIONS_PROC:
|
||||
case GIST_SORTSUPPORT_PROC:
|
||||
case GIST_STRATNUM_PROC:
|
||||
/* Optional, so force it to be a soft family dependency */
|
||||
op->ref_is_hard = false;
|
||||
op->ref_is_family = true;
|
||||
|
||||
Reference in New Issue
Block a user