summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2016-12-23 12:00:00 -0500
committerPeter Eisentraut <peter_e@gmx.net>2016-12-23 10:55:06 -0500
commit3e6639a465a5702d0aa98fc756b5ab8c7f97cde8 (patch)
treeec08c2f64d57d7a93b59510ec7954a27819744cc
parente13486eba05cc46951a34263d19b65d1eca0176b (diff)
downloadpostgresql-3e6639a465a5702d0aa98fc756b5ab8c7f97cde8.tar.gz
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.
-rw-r--r--src/bin/pg_dump/pg_dump.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index affe73a7c3..e5545b31d4 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -15430,8 +15430,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
if (fout->remoteVersion >= 100000)
{
appendPQExpBuffer(query,
- "SELECT relname, "
- "seqstart, seqincrement, "
+ "SELECT seqstart, seqincrement, "
"CASE WHEN seqincrement > 0 AND seqmax = %s THEN NULL "
" WHEN seqincrement < 0 AND seqmax = -1 THEN NULL "
" ELSE seqmax "
@@ -15450,8 +15449,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
else if (fout->remoteVersion >= 80400)
{
appendPQExpBuffer(query,
- "SELECT sequence_name, "
- "start_value, increment_by, "
+ "SELECT start_value, increment_by, "
"CASE WHEN increment_by > 0 AND max_value = %s THEN NULL "
" WHEN increment_by < 0 AND max_value = -1 THEN NULL "
" ELSE max_value "
@@ -15467,8 +15465,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
else
{
appendPQExpBuffer(query,
- "SELECT sequence_name, "
- "0 AS start_value, increment_by, "
+ "SELECT 0 AS start_value, increment_by, "
"CASE WHEN increment_by > 0 AND max_value = %s THEN NULL "
" WHEN increment_by < 0 AND max_value = -1 THEN NULL "
" ELSE max_value "
@@ -15493,24 +15490,14 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
exit_nicely(1);
}
- /* Disable this check: it fails if sequence has been renamed */
-#ifdef NOT_USED
- if (strcmp(PQgetvalue(res, 0, 0), tbinfo->dobj.name) != 0)
- {
- write_msg(NULL, "query to get data of sequence \"%s\" returned name \"%s\"\n",
- tbinfo->dobj.name, PQgetvalue(res, 0, 0));
- exit_nicely(1);
- }
-#endif
-
- startv = PQgetvalue(res, 0, 1);
- incby = PQgetvalue(res, 0, 2);
+ startv = PQgetvalue(res, 0, 0);
+ incby = PQgetvalue(res, 0, 1);
+ if (!PQgetisnull(res, 0, 2))
+ maxv = PQgetvalue(res, 0, 2);
if (!PQgetisnull(res, 0, 3))
- maxv = PQgetvalue(res, 0, 3);
- if (!PQgetisnull(res, 0, 4))
- minv = PQgetvalue(res, 0, 4);
- cache = PQgetvalue(res, 0, 5);
- cycled = (strcmp(PQgetvalue(res, 0, 6), "t") == 0);
+ minv = PQgetvalue(res, 0, 3);
+ cache = PQgetvalue(res, 0, 4);
+ cycled = (strcmp(PQgetvalue(res, 0, 5), "t") == 0);
/*
* DROP must be fully qualified in case same name appears in pg_catalog