mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
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.
This commit is contained in:
parent
e13486eba0
commit
3e6639a465
@ -15430,8 +15430,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
|
|||||||
if (fout->remoteVersion >= 100000)
|
if (fout->remoteVersion >= 100000)
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBuffer(query,
|
||||||
"SELECT relname, "
|
"SELECT seqstart, seqincrement, "
|
||||||
"seqstart, seqincrement, "
|
|
||||||
"CASE WHEN seqincrement > 0 AND seqmax = %s THEN NULL "
|
"CASE WHEN seqincrement > 0 AND seqmax = %s THEN NULL "
|
||||||
" WHEN seqincrement < 0 AND seqmax = -1 THEN NULL "
|
" WHEN seqincrement < 0 AND seqmax = -1 THEN NULL "
|
||||||
" ELSE seqmax "
|
" ELSE seqmax "
|
||||||
@ -15450,8 +15449,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
|
|||||||
else if (fout->remoteVersion >= 80400)
|
else if (fout->remoteVersion >= 80400)
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBuffer(query,
|
||||||
"SELECT sequence_name, "
|
"SELECT start_value, increment_by, "
|
||||||
"start_value, increment_by, "
|
|
||||||
"CASE WHEN increment_by > 0 AND max_value = %s THEN NULL "
|
"CASE WHEN increment_by > 0 AND max_value = %s THEN NULL "
|
||||||
" WHEN increment_by < 0 AND max_value = -1 THEN NULL "
|
" WHEN increment_by < 0 AND max_value = -1 THEN NULL "
|
||||||
" ELSE max_value "
|
" ELSE max_value "
|
||||||
@ -15467,8 +15465,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBuffer(query,
|
||||||
"SELECT sequence_name, "
|
"SELECT 0 AS start_value, increment_by, "
|
||||||
"0 AS start_value, increment_by, "
|
|
||||||
"CASE WHEN increment_by > 0 AND max_value = %s THEN NULL "
|
"CASE WHEN increment_by > 0 AND max_value = %s THEN NULL "
|
||||||
" WHEN increment_by < 0 AND max_value = -1 THEN NULL "
|
" WHEN increment_by < 0 AND max_value = -1 THEN NULL "
|
||||||
" ELSE max_value "
|
" ELSE max_value "
|
||||||
@ -15493,24 +15490,14 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
|
|||||||
exit_nicely(1);
|
exit_nicely(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable this check: it fails if sequence has been renamed */
|
startv = PQgetvalue(res, 0, 0);
|
||||||
#ifdef NOT_USED
|
incby = PQgetvalue(res, 0, 1);
|
||||||
if (strcmp(PQgetvalue(res, 0, 0), tbinfo->dobj.name) != 0)
|
if (!PQgetisnull(res, 0, 2))
|
||||||
{
|
maxv = PQgetvalue(res, 0, 2);
|
||||||
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);
|
|
||||||
if (!PQgetisnull(res, 0, 3))
|
if (!PQgetisnull(res, 0, 3))
|
||||||
maxv = PQgetvalue(res, 0, 3);
|
minv = PQgetvalue(res, 0, 3);
|
||||||
if (!PQgetisnull(res, 0, 4))
|
cache = PQgetvalue(res, 0, 4);
|
||||||
minv = PQgetvalue(res, 0, 4);
|
cycled = (strcmp(PQgetvalue(res, 0, 5), "t") == 0);
|
||||||
cache = PQgetvalue(res, 0, 5);
|
|
||||||
cycled = (strcmp(PQgetvalue(res, 0, 6), "t") == 0);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DROP must be fully qualified in case same name appears in pg_catalog
|
* DROP must be fully qualified in case same name appears in pg_catalog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user