Skip to content

Commit 3e6639a

Browse files
committed
pg_dump: Remove obsolete handling of sequence names
There was code that attempted to check whether the sequence name stored inside the sequence was the same as the name in pg_class. But that code was already ifdef'ed out, and now that the sequence no longer stores its own name, it's altogether obsolete, so remove it.
1 parent e13486e commit 3e6639a

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15430,8 +15430,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
1543015430
if (fout->remoteVersion >= 100000)
1543115431
{
1543215432
appendPQExpBuffer(query,
15433-
"SELECT relname, "
15434-
"seqstart, seqincrement, "
15433+
"SELECT seqstart, seqincrement, "
1543515434
"CASE WHEN seqincrement > 0 AND seqmax = %s THEN NULL "
1543615435
" WHEN seqincrement < 0 AND seqmax = -1 THEN NULL "
1543715436
" ELSE seqmax "
@@ -15450,8 +15449,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
1545015449
else if (fout->remoteVersion >= 80400)
1545115450
{
1545215451
appendPQExpBuffer(query,
15453-
"SELECT sequence_name, "
15454-
"start_value, increment_by, "
15452+
"SELECT start_value, increment_by, "
1545515453
"CASE WHEN increment_by > 0 AND max_value = %s THEN NULL "
1545615454
" WHEN increment_by < 0 AND max_value = -1 THEN NULL "
1545715455
" ELSE max_value "
@@ -15467,8 +15465,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
1546715465
else
1546815466
{
1546915467
appendPQExpBuffer(query,
15470-
"SELECT sequence_name, "
15471-
"0 AS start_value, increment_by, "
15468+
"SELECT 0 AS start_value, increment_by, "
1547215469
"CASE WHEN increment_by > 0 AND max_value = %s THEN NULL "
1547315470
" WHEN increment_by < 0 AND max_value = -1 THEN NULL "
1547415471
" ELSE max_value "
@@ -15493,24 +15490,14 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
1549315490
exit_nicely(1);
1549415491
}
1549515492

15496-
/* Disable this check: it fails if sequence has been renamed */
15497-
#ifdef NOT_USED
15498-
if (strcmp(PQgetvalue(res, 0, 0), tbinfo->dobj.name) != 0)
15499-
{
15500-
write_msg(NULL, "query to get data of sequence \"%s\" returned name \"%s\"\n",
15501-
tbinfo->dobj.name, PQgetvalue(res, 0, 0));
15502-
exit_nicely(1);
15503-
}
15504-
#endif
15505-
15506-
startv = PQgetvalue(res, 0, 1);
15507-
incby = PQgetvalue(res, 0, 2);
15493+
startv = PQgetvalue(res, 0, 0);
15494+
incby = PQgetvalue(res, 0, 1);
15495+
if (!PQgetisnull(res, 0, 2))
15496+
maxv = PQgetvalue(res, 0, 2);
1550815497
if (!PQgetisnull(res, 0, 3))
15509-
maxv = PQgetvalue(res, 0, 3);
15510-
if (!PQgetisnull(res, 0, 4))
15511-
minv = PQgetvalue(res, 0, 4);
15512-
cache = PQgetvalue(res, 0, 5);
15513-
cycled = (strcmp(PQgetvalue(res, 0, 6), "t") == 0);
15498+
minv = PQgetvalue(res, 0, 3);
15499+
cache = PQgetvalue(res, 0, 4);
15500+
cycled = (strcmp(PQgetvalue(res, 0, 5), "t") == 0);
1551415501

1551515502
/*
1551615503
* DROP must be fully qualified in case same name appears in pg_catalog

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy