Is necessary to use SEQ_MAXVALUE in pg_dump? - Mailing list pgsql-hackers

From Zdenek Kotala
Subject Is necessary to use SEQ_MAXVALUE in pg_dump?
Date
Msg-id 472F5F32.6000504@sun.com
Whole thread Raw
Responses Re: Is necessary to use SEQ_MAXVALUE in pg_dump?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I'm trying fix independence of pg_dump.c on postgres.h. And I found 
following construct in dumpSequence function:



09391     snprintf(bufm, sizeof(bufm), INT64_FORMAT, SEQ_MINVALUE);
09392     snprintf(bufx, sizeof(bufx), INT64_FORMAT, SEQ_MAXVALUE);
09393
09394     appendPQExpBuffer(query,
09395                       "SELECT sequence_name, last_value, 
increment_by, "
09396                    "CASE WHEN increment_by > 0 AND max_value = %s 
THEN NULL "
09397                    "     WHEN increment_by < 0 AND max_value = -1 
THEN NULL "
09398                       "     ELSE max_value "
09399                       "END AS max_value, "
09400                     "CASE WHEN increment_by > 0 AND min_value = 1 
THEN NULL "
09401                    "     WHEN increment_by < 0 AND min_value = %s 
THEN NULL "
09402                       "     ELSE min_value "
09403                       "END AS min_value, "
09404                       "cache_value, is_cycled, is_called from %s",
09405                       bufx, bufm,
09406                       fmtId(tbinfo->dobj.name));


This construct is used to determine if max_value/min_value is used and 
after that pg_dump add NO MAXVALUE to the output instead of the value. 
If I compare it with manual documentation NO MAXVALUE uses default value 
and I do not see any reason to have this code there. I think we can 
remove this code and release dependency on sequence.h.
    Any comments?
        Zdenek


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: plpgsql keywords are hidden reserved words
Next
From: Bruce Momjian
Date:
Subject: Re: Open items for 8.3