mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +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 function46a0cd4cef
Add temporal PRIMARY KEY and UNIQUE constraints86232a49a4
Fix comment on gist_stratnum_btree030e10ff1a
Rename pg_constraint.conwithoutoverlaps to conperioda88c800deb
Use daterange and YMD in without_overlaps tests instead of tsrange.5577a71fb0
Use half-open interval notation in without_overlaps tests34768ee361
Add temporal FOREIGN KEY contraints482e108cd3
Add test for REPLICA IDENTITY with a temporal keyc3db1f30cb
doc: clarify PERIOD and WITHOUT OVERLAPS in CREATE TABLE144c2ce0cc
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:
@ -338,7 +338,7 @@ static char *pg_get_viewdef_worker(Oid viewoid,
|
||||
int prettyFlags, int wrapColumn);
|
||||
static char *pg_get_triggerdef_worker(Oid trigid, bool pretty);
|
||||
static int decompile_column_index_array(Datum column_index_array, Oid relId,
|
||||
bool withPeriod, StringInfo buf);
|
||||
StringInfo buf);
|
||||
static char *pg_get_ruledef_worker(Oid ruleoid, int prettyFlags);
|
||||
static char *pg_get_indexdef_worker(Oid indexrelid, int colno,
|
||||
const Oid *excludeOps,
|
||||
@ -2260,8 +2260,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
val = SysCacheGetAttrNotNull(CONSTROID, tup,
|
||||
Anum_pg_constraint_conkey);
|
||||
|
||||
/* If it is a temporal foreign key then it uses PERIOD. */
|
||||
decompile_column_index_array(val, conForm->conrelid, conForm->conperiod, &buf);
|
||||
decompile_column_index_array(val, conForm->conrelid, &buf);
|
||||
|
||||
/* add foreign relation name */
|
||||
appendStringInfo(&buf, ") REFERENCES %s(",
|
||||
@ -2272,7 +2271,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
val = SysCacheGetAttrNotNull(CONSTROID, tup,
|
||||
Anum_pg_constraint_confkey);
|
||||
|
||||
decompile_column_index_array(val, conForm->confrelid, conForm->conperiod, &buf);
|
||||
decompile_column_index_array(val, conForm->confrelid, &buf);
|
||||
|
||||
appendStringInfoChar(&buf, ')');
|
||||
|
||||
@ -2358,7 +2357,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
if (!isnull)
|
||||
{
|
||||
appendStringInfoString(&buf, " (");
|
||||
decompile_column_index_array(val, conForm->conrelid, false, &buf);
|
||||
decompile_column_index_array(val, conForm->conrelid, &buf);
|
||||
appendStringInfoChar(&buf, ')');
|
||||
}
|
||||
|
||||
@ -2393,9 +2392,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
val = SysCacheGetAttrNotNull(CONSTROID, tup,
|
||||
Anum_pg_constraint_conkey);
|
||||
|
||||
keyatts = decompile_column_index_array(val, conForm->conrelid, false, &buf);
|
||||
if (conForm->conperiod)
|
||||
appendStringInfoString(&buf, " WITHOUT OVERLAPS");
|
||||
keyatts = decompile_column_index_array(val, conForm->conrelid, &buf);
|
||||
|
||||
appendStringInfoChar(&buf, ')');
|
||||
|
||||
@ -2577,7 +2574,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
*/
|
||||
static int
|
||||
decompile_column_index_array(Datum column_index_array, Oid relId,
|
||||
bool withPeriod, StringInfo buf)
|
||||
StringInfo buf)
|
||||
{
|
||||
Datum *keys;
|
||||
int nKeys;
|
||||
@ -2596,9 +2593,7 @@ decompile_column_index_array(Datum column_index_array, Oid relId,
|
||||
if (j == 0)
|
||||
appendStringInfoString(buf, quote_identifier(colName));
|
||||
else
|
||||
appendStringInfo(buf, ", %s%s",
|
||||
(withPeriod && j == nKeys - 1) ? "PERIOD " : "",
|
||||
quote_identifier(colName));
|
||||
appendStringInfo(buf, ", %s", quote_identifier(colName));
|
||||
}
|
||||
|
||||
return nKeys;
|
||||
|
Reference in New Issue
Block a user