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

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to