pgsql: Ensure variables live across calls in generate_series(numeric, n

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Ensure variables live across calls in generate_series(numeric, n
Date: 2014-12-18 12:15:32
Message-ID: E1Y1ZzQ-0003jb-1r@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Ensure variables live across calls in generate_series(numeric, numeric).

In generate_series_step_numeric(), the variables "start_num"
and "stop_num" may be potentially freed until the next call.
So they should be put in the location which can survive across calls.
But previously they were not, and which could cause incorrect
behavior of generate_series(numeric, numeric). This commit fixes
this problem by copying them on multi_call_memory_ctx.

Andrew Gierth

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/19e065c0492c34fbccbd2c3707ba68cff14195a3

Modified Files
--------------
src/backend/utils/adt/numeric.c | 11 +++++++---
src/test/regress/expected/numeric.out | 38 +++++++++++++++++++++++++++++++++
src/test/regress/sql/numeric.sql | 4 ++++
3 files changed, 50 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2014-12-18 14:08:09 pgsql: Add memory barriers for PgBackendStatus.st_changecount protocol.
Previous Message Fujii Masao 2014-12-18 10:58:39 pgsql: Update .gitignore for config.cache.