Skip to content

Commit ab4fd4f

Browse files
committed
Remove 'datlastsysoid'.
It hasn't been used for anything for a long time. Up until recently, we still queried it when dumping very old servers, but since commit 30e7c17, there's no longer any code at all that cares about it. Discussion: http://postgr.es/m/CA+Tgmoa14=BRq0WEd0eevjEMn9EkghDB1FZEkBw7+UAb7tF49A@mail.gmail.com
1 parent b700f96 commit ab4fd4f

File tree

8 files changed

+9
-38
lines changed

8 files changed

+9
-38
lines changed

doc/src/sgml/bki.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
descr => 'database\'s default template',
184184
datname => 'template1', encoding => 'ENCODING', datcollate => 'LC_COLLATE',
185185
datctype => 'LC_CTYPE', datistemplate => 't', datallowconn => 't',
186-
datconnlimit => '-1', datlastsysoid => '0', datfrozenxid => '0',
186+
datconnlimit => '-1', datfrozenxid => '0',
187187
datminmxid => '1', dattablespace => 'pg_default', datacl => '_null_' },
188188

189189
]

doc/src/sgml/catalogs.sgml

-10
Original file line numberDiff line numberDiff line change
@@ -3001,16 +3001,6 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
30013001
</para></entry>
30023002
</row>
30033003

3004-
<row>
3005-
<entry role="catalog_table_entry"><para role="column_definition">
3006-
<structfield>datlastsysoid</structfield> <type>oid</type>
3007-
</para>
3008-
<para>
3009-
Last system OID in the database; useful
3010-
particularly to <application>pg_dump</application>
3011-
</para></entry>
3012-
</row>
3013-
30143004
<row>
30153005
<entry role="catalog_table_entry"><para role="column_definition">
30163006
<structfield>datfrozenxid</structfield> <type>xid</type>

doc/src/sgml/ecpg.sgml

-2
Original file line numberDiff line numberDiff line change
@@ -4732,7 +4732,6 @@ encoding = 0 (type: 5)
47324732
datistemplate = t (type: 1)
47334733
datallowconn = t (type: 1)
47344734
datconnlimit = -1 (type: 5)
4735-
datlastsysoid = 11510 (type: 1)
47364735
datfrozenxid = 379 (type: 1)
47374736
dattablespace = 1663 (type: 1)
47384737
datconfig = (type: 1)
@@ -4757,7 +4756,6 @@ encoding = 0 (type: 5)
47574756
datistemplate = f (type: 1)
47584757
datallowconn = t (type: 1)
47594758
datconnlimit = -1 (type: 5)
4760-
datlastsysoid = 11510 (type: 1)
47614759
datfrozenxid = 379 (type: 1)
47624760
dattablespace = 1663 (type: 1)
47634761
datconfig = (type: 1)

src/backend/commands/dbcommands.c

+6-13
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ static void movedb_failure_callback(int code, Datum arg);
8484
static bool get_db_info(const char *name, LOCKMODE lockmode,
8585
Oid *dbIdP, Oid *ownerIdP,
8686
int *encodingP, bool *dbIsTemplateP, bool *dbAllowConnP,
87-
Oid *dbLastSysOidP, TransactionId *dbFrozenXidP,
88-
MultiXactId *dbMinMultiP,
87+
TransactionId *dbFrozenXidP, MultiXactId *dbMinMultiP,
8988
Oid *dbTablespace, char **dbCollate, char **dbCtype);
9089
static bool have_createdb_privilege(void);
9190
static void remove_dbtablespaces(Oid db_id);
@@ -108,7 +107,6 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
108107
char *src_ctype = NULL;
109108
bool src_istemplate;
110109
bool src_allowconn;
111-
Oid src_lastsysoid = InvalidOid;
112110
TransactionId src_frozenxid = InvalidTransactionId;
113111
MultiXactId src_minmxid = InvalidMultiXactId;
114112
Oid src_deftablespace;
@@ -318,7 +316,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
318316

319317
if (!get_db_info(dbtemplate, ShareLock,
320318
&src_dboid, &src_owner, &src_encoding,
321-
&src_istemplate, &src_allowconn, &src_lastsysoid,
319+
&src_istemplate, &src_allowconn,
322320
&src_frozenxid, &src_minmxid, &src_deftablespace,
323321
&src_collate, &src_ctype))
324322
ereport(ERROR,
@@ -532,7 +530,6 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
532530
new_record[Anum_pg_database_datistemplate - 1] = BoolGetDatum(dbistemplate);
533531
new_record[Anum_pg_database_datallowconn - 1] = BoolGetDatum(dballowconnections);
534532
new_record[Anum_pg_database_datconnlimit - 1] = Int32GetDatum(dbconnlimit);
535-
new_record[Anum_pg_database_datlastsysoid - 1] = ObjectIdGetDatum(src_lastsysoid);
536533
new_record[Anum_pg_database_datfrozenxid - 1] = TransactionIdGetDatum(src_frozenxid);
537534
new_record[Anum_pg_database_datminmxid - 1] = TransactionIdGetDatum(src_minmxid);
538535
new_record[Anum_pg_database_dattablespace - 1] = ObjectIdGetDatum(dst_deftablespace);
@@ -802,7 +799,7 @@ dropdb(const char *dbname, bool missing_ok, bool force)
802799
pgdbrel = table_open(DatabaseRelationId, RowExclusiveLock);
803800

804801
if (!get_db_info(dbname, AccessExclusiveLock, &db_id, NULL, NULL,
805-
&db_istemplate, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
802+
&db_istemplate, NULL, NULL, NULL, NULL, NULL, NULL))
806803
{
807804
if (!missing_ok)
808805
{
@@ -1001,7 +998,7 @@ RenameDatabase(const char *oldname, const char *newname)
1001998
rel = table_open(DatabaseRelationId, RowExclusiveLock);
1002999

10031000
if (!get_db_info(oldname, AccessExclusiveLock, &db_id, NULL, NULL,
1004-
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
1001+
NULL, NULL, NULL, NULL, NULL, NULL, NULL))
10051002
ereport(ERROR,
10061003
(errcode(ERRCODE_UNDEFINED_DATABASE),
10071004
errmsg("database \"%s\" does not exist", oldname)));
@@ -1114,7 +1111,7 @@ movedb(const char *dbname, const char *tblspcname)
11141111
pgdbrel = table_open(DatabaseRelationId, RowExclusiveLock);
11151112

11161113
if (!get_db_info(dbname, AccessExclusiveLock, &db_id, NULL, NULL,
1117-
NULL, NULL, NULL, NULL, NULL, &src_tblspcoid, NULL, NULL))
1114+
NULL, NULL, NULL, NULL, &src_tblspcoid, NULL, NULL))
11181115
ereport(ERROR,
11191116
(errcode(ERRCODE_UNDEFINED_DATABASE),
11201117
errmsg("database \"%s\" does not exist", dbname)));
@@ -1757,8 +1754,7 @@ static bool
17571754
get_db_info(const char *name, LOCKMODE lockmode,
17581755
Oid *dbIdP, Oid *ownerIdP,
17591756
int *encodingP, bool *dbIsTemplateP, bool *dbAllowConnP,
1760-
Oid *dbLastSysOidP, TransactionId *dbFrozenXidP,
1761-
MultiXactId *dbMinMultiP,
1757+
TransactionId *dbFrozenXidP, MultiXactId *dbMinMultiP,
17621758
Oid *dbTablespace, char **dbCollate, char **dbCtype)
17631759
{
17641760
bool result = false;
@@ -1839,9 +1835,6 @@ get_db_info(const char *name, LOCKMODE lockmode,
18391835
/* allowing connections? */
18401836
if (dbAllowConnP)
18411837
*dbAllowConnP = dbform->datallowconn;
1842-
/* last system OID used in database */
1843-
if (dbLastSysOidP)
1844-
*dbLastSysOidP = dbform->datlastsysoid;
18451838
/* limit of frozen XIDs */
18461839
if (dbFrozenXidP)
18471840
*dbFrozenXidP = dbform->datfrozenxid;

src/bin/initdb/initdb.c

-7
Original file line numberDiff line numberDiff line change
@@ -1841,13 +1841,6 @@ make_template0(FILE *cmdfd)
18411841
static const char *const template0_setup[] = {
18421842
"CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;\n\n",
18431843

1844-
/*
1845-
* We use the OID of template0 to determine datlastsysoid
1846-
*/
1847-
"UPDATE pg_database SET datlastsysoid = "
1848-
" (SELECT oid FROM pg_database "
1849-
" WHERE datname = 'template0');\n\n",
1850-
18511844
/*
18521845
* Explicitly revoke public create-schema and create-temp-table
18531846
* privileges in template1 and template0; else the latter would be on

src/include/catalog/catversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 202201191
56+
#define CATALOG_VERSION_NO 202201201
5757

5858
#endif

src/include/catalog/pg_database.dat

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
descr => 'default template for new databases',
1717
datname => 'template1', encoding => 'ENCODING', datcollate => 'LC_COLLATE',
1818
datctype => 'LC_CTYPE', datistemplate => 't', datallowconn => 't',
19-
datconnlimit => '-1', datlastsysoid => '0', datfrozenxid => '0',
19+
datconnlimit => '-1', datfrozenxid => '0',
2020
datminmxid => '1', dattablespace => 'pg_default', datacl => '_null_' },
2121

2222
]

src/include/catalog/pg_database.h

-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID
5555
/* max connections allowed (-1=no limit) */
5656
int32 datconnlimit;
5757

58-
/* highest OID to consider a system OID */
59-
Oid datlastsysoid;
60-
6158
/* all Xids < this are frozen in this DB */
6259
TransactionId datfrozenxid;
6360

0 commit comments

Comments
 (0)