Skip to content

PGPRO-6864: do not use the function pg_atoi if possible #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PGPRO-6864: do not use the function pg_atoi if possible
In PostgreSQL version 12 or higher it's more effecient to use the function
pg_strtoint32 instead (see the commit 86eaf208ea048936df6be77276a246d3f92e9620).
And in PostgreSQL 15 the function pg_atoi was removed altogether (see the commit
73508475d69e90f98ebd9b7e1a5933a26a49c5e9). Therefore if possible use the
function pg_strtoint32 instead.
  • Loading branch information
Marina Polyakova committed Jun 29, 2022
commit e45ff3833c4d022b8c055b90a7b254c1038d5f6b
4 changes: 4 additions & 0 deletions jsquery_gram.y
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ makeIndexArray(string *s)
{
JsQueryParseItem* v = makeItemType(jqiIndexArray);

#if PG_VERSION_NUM >= 120000
v->arrayIndex = pg_strtoint32(s->val);
#else
v->arrayIndex = pg_atoi(s->val, 4, 0);
#endif

return v;
}
Expand Down