From e79798a3fd39a64dbfe12d00e956d1bf89038e3c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 15 May 2024 10:37:07 +0200 Subject: [PATCH 07/10] Revert "Rename pg_constraint.conwithoutoverlaps to conperiod" This reverts commit 030e10ff1a365796bd4bcbbc5b6a8552f7efc765. --- doc/src/sgml/catalogs.sgml | 2 +- src/backend/catalog/heap.c | 2 +- src/backend/catalog/pg_constraint.c | 4 ++-- src/backend/commands/tablecmds.c | 6 +++--- src/backend/commands/trigger.c | 2 +- src/backend/commands/typecmds.c | 2 +- src/backend/utils/adt/ruleutils.c | 2 +- src/backend/utils/cache/relcache.c | 6 +++--- src/bin/pg_dump/pg_dump.c | 12 ++++++------ src/bin/pg_dump/pg_dump.h | 3 ++- src/bin/psql/describe.c | 4 ++-- src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_constraint.h | 4 ++-- 13 files changed, 26 insertions(+), 25 deletions(-) diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index b488bff904c..3e945c0590f 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -2731,7 +2731,7 @@ <structname>pg_constraint</structname> Columns - conperiod bool + conwithoutoverlaps bool This constraint is defined with WITHOUT OVERLAPS diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 08b8362d64d..91d27a36798 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -2155,7 +2155,7 @@ StoreRelCheck(Relation rel, const char *ccname, Node *expr, is_local, /* conislocal */ inhcount, /* coninhcount */ is_no_inherit, /* connoinherit */ - false, /* conperiod */ + false, /* conwithoutoverlaps */ is_internal); /* internally constructed? */ pfree(ccbin); diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c index 9be050ccee8..88284fafe89 100644 --- a/src/backend/catalog/pg_constraint.c +++ b/src/backend/catalog/pg_constraint.c @@ -75,7 +75,7 @@ CreateConstraintEntry(const char *constraintName, bool conIsLocal, int conInhCount, bool conNoInherit, - bool conPeriod, + bool conWithoutOverlaps, bool is_internal) { Relation conDesc; @@ -191,7 +191,7 @@ CreateConstraintEntry(const char *constraintName, values[Anum_pg_constraint_conislocal - 1] = BoolGetDatum(conIsLocal); values[Anum_pg_constraint_coninhcount - 1] = Int16GetDatum(conInhCount); values[Anum_pg_constraint_connoinherit - 1] = BoolGetDatum(conNoInherit); - values[Anum_pg_constraint_conperiod - 1] = BoolGetDatum(conPeriod); + values[Anum_pg_constraint_conwithoutoverlaps - 1] = BoolGetDatum(conWithoutOverlaps); if (conkeyArray) values[Anum_pg_constraint_conkey - 1] = PointerGetDatum(conkeyArray); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index cd33049788a..b88a4aaa617 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -10125,7 +10125,7 @@ addFkRecurseReferenced(List **wqueue, Constraint *fkconstraint, Relation rel, conislocal, /* islocal */ coninhcount, /* inhcount */ connoinherit, /* conNoInherit */ - false, /* conPeriod */ + false, /* conWithoutOverlaps */ false); /* is_internal */ ObjectAddressSet(address, ConstraintRelationId, constrOid); @@ -10424,7 +10424,7 @@ addFkRecurseReferencing(List **wqueue, Constraint *fkconstraint, Relation rel, false, 1, false, - false, /* conPeriod */ + false, /* conWithoutOverlaps */ false); /* @@ -10930,7 +10930,7 @@ CloneFkReferencing(List **wqueue, Relation parentRel, Relation partRel) false, /* islocal */ 1, /* inhcount */ false, /* conNoInherit */ - false, /* conPeriod */ + false, /* conWithoutOverlaps */ true); /* Set up partition dependencies for the new constraint */ diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 35eb7180f7e..3d35b64a57d 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -834,7 +834,7 @@ CreateTriggerFiringOn(CreateTrigStmt *stmt, const char *queryString, true, /* islocal */ 0, /* inhcount */ true, /* noinherit */ - false, /* conperiod */ + false, /* conwithoutoverlaps */ isInternal); /* is_internal */ } diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 2a6550de907..fc9eebd29b2 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -3621,7 +3621,7 @@ domainAddCheckConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, true, /* is local */ 0, /* inhcount */ false, /* connoinherit */ - false, /* conperiod */ + false, /* conwithoutoverlaps */ false); /* is_internal */ if (constrAddr) ObjectAddressSet(*constrAddr, ConstraintRelationId, ccoid); diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index d4526487da9..926d3d5834d 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -2393,7 +2393,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand, Anum_pg_constraint_conkey); keyatts = decompile_column_index_array(val, conForm->conrelid, &buf); - if (conForm->conperiod) + if (conForm->conwithoutoverlaps) appendStringInfoString(&buf, " WITHOUT OVERLAPS"); appendStringInfoChar(&buf, ')'); diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index e6072cbdd9e..01b2b701756 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -5612,9 +5612,9 @@ RelationGetExclusionInfo(Relation indexRelation, /* We want the exclusion constraint owning the index */ if ((conform->contype != CONSTRAINT_EXCLUSION && - !(conform->conperiod && ( - conform->contype == CONSTRAINT_PRIMARY - || conform->contype == CONSTRAINT_UNIQUE))) || + !(conform->conwithoutoverlaps && ( + conform->contype == CONSTRAINT_PRIMARY + || conform->contype == CONSTRAINT_UNIQUE))) || conform->conindid != RelationGetRelid(indexRelation)) continue; diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index ac920f64c73..10409011eb2 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -7344,7 +7344,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) i_conname, i_condeferrable, i_condeferred, - i_conperiod, + i_conwithoutoverlaps, i_contableoid, i_conoid, i_condef, @@ -7433,10 +7433,10 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) if (fout->remoteVersion >= 170000) appendPQExpBufferStr(query, - "c.conperiod "); + "c.conwithoutoverlaps "); else appendPQExpBufferStr(query, - "NULL AS conperiod "); + "NULL AS conwithoutoverlaps "); /* * The point of the messy-looking outer join is to find a constraint that @@ -7504,7 +7504,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) i_conname = PQfnumber(res, "conname"); i_condeferrable = PQfnumber(res, "condeferrable"); i_condeferred = PQfnumber(res, "condeferred"); - i_conperiod = PQfnumber(res, "conperiod"); + i_conwithoutoverlaps = PQfnumber(res, "conwithoutoverlaps"); i_contableoid = PQfnumber(res, "contableoid"); i_conoid = PQfnumber(res, "conoid"); i_condef = PQfnumber(res, "condef"); @@ -7612,7 +7612,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) constrinfo->conindex = indxinfo[j].dobj.dumpId; constrinfo->condeferrable = *(PQgetvalue(res, j, i_condeferrable)) == 't'; constrinfo->condeferred = *(PQgetvalue(res, j, i_condeferred)) == 't'; - constrinfo->conperiod = *(PQgetvalue(res, j, i_conperiod)) == 't'; + constrinfo->conwithoutoverlaps = *(PQgetvalue(res, j, i_conwithoutoverlaps)) == 't'; constrinfo->conislocal = true; constrinfo->separate = true; @@ -17058,7 +17058,7 @@ dumpConstraint(Archive *fout, const ConstraintInfo *coninfo) (k == 0) ? "" : ", ", fmtId(attname)); } - if (coninfo->conperiod) + if (coninfo->conwithoutoverlaps) appendPQExpBufferStr(q, " WITHOUT OVERLAPS"); if (indxinfo->indnkeyattrs < indxinfo->indnattrs) diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index f518a1e6d2a..e8db47f93d2 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -474,7 +474,8 @@ typedef struct _constraintInfo DumpId conindex; /* identifies associated index if any */ bool condeferrable; /* true if constraint is DEFERRABLE */ bool condeferred; /* true if constraint is INITIALLY DEFERRED */ - bool conperiod; /* true if the constraint is WITHOUT OVERLAPS */ + bool conwithoutoverlaps; /* true if the constraint is WITHOUT + * OVERLAPS */ bool conislocal; /* true if constraint has local definition */ bool separate; /* true if must dump as separate item */ } ConstraintInfo; diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 3af44acef1d..8856079a290 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -2384,9 +2384,9 @@ describeOneTableDetails(const char *schemaname, appendPQExpBufferStr(&buf, ", false AS indisreplident"); appendPQExpBufferStr(&buf, ", c2.reltablespace"); if (pset.sversion >= 170000) - appendPQExpBufferStr(&buf, ", con.conperiod"); + appendPQExpBufferStr(&buf, ", con.conwithoutoverlaps"); else - appendPQExpBufferStr(&buf, ", false AS conperiod"); + appendPQExpBufferStr(&buf, ", false AS conwithoutoverlaps"); appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i\n" " LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x'))\n" diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 4b89f980925..1f45f5c8deb 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -57,6 +57,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202405141 +#define CATALOG_VERSION_NO 202405151 #endif diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h index 96c00624b15..af588719601 100644 --- a/src/include/catalog/pg_constraint.h +++ b/src/include/catalog/pg_constraint.h @@ -111,7 +111,7 @@ CATALOG(pg_constraint,2606,ConstraintRelationId) * For primary keys and unique constraints, signifies the last column uses * overlaps instead of equals. */ - bool conperiod; + bool conwithoutoverlaps; #ifdef CATALOG_VARLEN /* variable-length fields start here */ @@ -245,7 +245,7 @@ extern Oid CreateConstraintEntry(const char *constraintName, bool conIsLocal, int conInhCount, bool conNoInherit, - bool conPeriod, + bool conWithoutOverlaps, bool is_internal); extern bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId, -- 2.44.0