Re: pg_dump sometimes misses sequence parameters
От | Alexey Bashtanov |
---|---|
Тема | Re: pg_dump sometimes misses sequence parameters |
Дата | |
Msg-id | ad692667-fe43-62c5-5e55-e40a8596b621@imap.cc обсуждение исходный текст |
Ответ на | Re: pg_dump sometimes misses sequence parameters (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: pg_dump sometimes misses sequence parameters
|
Список | pgsql-bugs |
Hi Tom,
or simplification if we anyway do the conversions below.
preprocessor language either, and I don't think it would be easy
to write one.
Unwilling to define the decimal representations constants, we have to
convert those strings representations to binary ones
(in case of smallint/integer sequences) or visa versa (bigint).
Current code looks somewhat fragile to me, as it takes some time to assure
it doesn't pass already nulled out minv or maxv to atoi or strcmp again.
I've rewritten it in a bit more clear way, so each comparison and nulling out
happens only once. Choosing between atol/atoll vs snprintf+strcmp,
I preferred the former, as the latter is slower and uglier to me.
Should we need any further speedup, I'd go for decimal representation
constants really.
BTW what should I do when submitting a patch if my autoconf adds
some irrelevant changes?
Best regards,
Alexey Bashtanov
That will only fix it on platforms where long is 64 bits.Oops. I erroneously thought its size could drift the other way.
I think that converting these strings to integer at all is a dumb idea. It would beAgree for those two. However, I don't see it as a substantial speedup
much better to write the first two tests like
if (is_ascending && strcmp(minv, "1") == 0)
minv = NULL;
if (!is_ascending && strcmp(maxv, "-1") == 0)
maxv = NULL;
or simplification if we anyway do the conversions below.
It's tempting to try to make the remaining tests look similar, butI didn't manage to find a snprintf-like thing implemented in C
I'm not quite sure how without writing out the exact decimal values
of the constants, which probably isn't better. I experimented with
stuff like "strcmp(minv, CppAsString2(PG_INT32_MIN))" but that
doesn't quite do what we need.
preprocessor language either, and I don't think it would be easy
to write one.
Unwilling to define the decimal representations constants, we have to
convert those strings representations to binary ones
(in case of smallint/integer sequences) or visa versa (bigint).
Current code looks somewhat fragile to me, as it takes some time to assure
it doesn't pass already nulled out minv or maxv to atoi or strcmp again.
I've rewritten it in a bit more clear way, so each comparison and nulling out
happens only once. Choosing between atol/atoll vs snprintf+strcmp,
I preferred the former, as the latter is slower and uglier to me.
Should we need any further speedup, I'd go for decimal representation
constants really.
BTW what should I do when submitting a patch if my autoconf adds
some irrelevant changes?
Best regards,
Alexey Bashtanov
Вложения
В списке pgsql-bugs по дате отправления: