pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. 6+ messages / 1 participants [nested] [flat]
* pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. @ 2018-11-14 16:28 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-11-14 16:28 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Second try at fixing numeric data passed through an ECPG SQLDA. In commit ecfd55795, I removed sqlda.c's checks for ndigits != 0 on the grounds that we should duplicate the state of the numeric value's digit buffer even when all the digits are zeroes. However, that still isn't quite right, because another possible state of the digit buffer is buf == digits == NULL (this occurs for a NaN). As the code now stands, it'll invoke memcpy with a NULL source address and zero bytecount, which we know a few platforms crash on. Hence, reinstate the no-copy short-circuit, but make it test specifically for buf != NULL rather than some other condition. In hindsight, the ndigits test (added by commit f2ae9f9c3) was almost certainly meant to fix the NaN case not the all-zeroes case as the associated thread alleged. As before, back-patch to all supported versions. Discussion: https://postgr.es/m/1803D792815FC24D871C00D17AE95905C71161@g01jpexmbkw24 Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4618fdd674128ad62096619d449f248b0ecc3ed7 Modified Files -------------- src/interfaces/ecpg/ecpglib/sqlda.c | 25 ++++++++++++++-------- src/interfaces/ecpg/test/expected/sql-sqlda.c | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stderr | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stdout | 8 +++---- src/interfaces/ecpg/test/sql/sqlda.pgc | 2 +- 5 files changed, 23 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. @ 2018-11-14 16:28 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-11-14 16:28 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Second try at fixing numeric data passed through an ECPG SQLDA. In commit ecfd55795, I removed sqlda.c's checks for ndigits != 0 on the grounds that we should duplicate the state of the numeric value's digit buffer even when all the digits are zeroes. However, that still isn't quite right, because another possible state of the digit buffer is buf == digits == NULL (this occurs for a NaN). As the code now stands, it'll invoke memcpy with a NULL source address and zero bytecount, which we know a few platforms crash on. Hence, reinstate the no-copy short-circuit, but make it test specifically for buf != NULL rather than some other condition. In hindsight, the ndigits test (added by commit f2ae9f9c3) was almost certainly meant to fix the NaN case not the all-zeroes case as the associated thread alleged. As before, back-patch to all supported versions. Discussion: https://postgr.es/m/1803D792815FC24D871C00D17AE95905C71161@g01jpexmbkw24 Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/68f30638a050b5798f5947fe54a0ecb482203d05 Modified Files -------------- src/interfaces/ecpg/ecpglib/sqlda.c | 25 ++++++++++++++-------- src/interfaces/ecpg/test/expected/sql-sqlda.c | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stderr | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stdout | 8 +++---- src/interfaces/ecpg/test/sql/sqlda.pgc | 2 +- 5 files changed, 23 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. @ 2018-11-14 16:28 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-11-14 16:28 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Second try at fixing numeric data passed through an ECPG SQLDA. In commit ecfd55795, I removed sqlda.c's checks for ndigits != 0 on the grounds that we should duplicate the state of the numeric value's digit buffer even when all the digits are zeroes. However, that still isn't quite right, because another possible state of the digit buffer is buf == digits == NULL (this occurs for a NaN). As the code now stands, it'll invoke memcpy with a NULL source address and zero bytecount, which we know a few platforms crash on. Hence, reinstate the no-copy short-circuit, but make it test specifically for buf != NULL rather than some other condition. In hindsight, the ndigits test (added by commit f2ae9f9c3) was almost certainly meant to fix the NaN case not the all-zeroes case as the associated thread alleged. As before, back-patch to all supported versions. Discussion: https://postgr.es/m/1803D792815FC24D871C00D17AE95905C71161@g01jpexmbkw24 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/06c723447b6b8fc7e394cd2ad23785a6e54e36da Modified Files -------------- src/interfaces/ecpg/ecpglib/sqlda.c | 25 ++++++++++++++-------- src/interfaces/ecpg/test/expected/sql-sqlda.c | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stderr | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stdout | 8 +++---- src/interfaces/ecpg/test/sql/sqlda.pgc | 2 +- 5 files changed, 23 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. @ 2018-11-14 16:28 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-11-14 16:28 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Second try at fixing numeric data passed through an ECPG SQLDA. In commit ecfd55795, I removed sqlda.c's checks for ndigits != 0 on the grounds that we should duplicate the state of the numeric value's digit buffer even when all the digits are zeroes. However, that still isn't quite right, because another possible state of the digit buffer is buf == digits == NULL (this occurs for a NaN). As the code now stands, it'll invoke memcpy with a NULL source address and zero bytecount, which we know a few platforms crash on. Hence, reinstate the no-copy short-circuit, but make it test specifically for buf != NULL rather than some other condition. In hindsight, the ndigits test (added by commit f2ae9f9c3) was almost certainly meant to fix the NaN case not the all-zeroes case as the associated thread alleged. As before, back-patch to all supported versions. Discussion: https://postgr.es/m/1803D792815FC24D871C00D17AE95905C71161@g01jpexmbkw24 Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2e8ed46599720113ce024f098e12652a1dfffe8e Modified Files -------------- src/interfaces/ecpg/ecpglib/sqlda.c | 25 ++++++++++++++-------- src/interfaces/ecpg/test/expected/sql-sqlda.c | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stderr | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stdout | 8 +++---- src/interfaces/ecpg/test/sql/sqlda.pgc | 2 +- 5 files changed, 23 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. @ 2018-11-14 16:28 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-11-14 16:28 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Second try at fixing numeric data passed through an ECPG SQLDA. In commit ecfd55795, I removed sqlda.c's checks for ndigits != 0 on the grounds that we should duplicate the state of the numeric value's digit buffer even when all the digits are zeroes. However, that still isn't quite right, because another possible state of the digit buffer is buf == digits == NULL (this occurs for a NaN). As the code now stands, it'll invoke memcpy with a NULL source address and zero bytecount, which we know a few platforms crash on. Hence, reinstate the no-copy short-circuit, but make it test specifically for buf != NULL rather than some other condition. In hindsight, the ndigits test (added by commit f2ae9f9c3) was almost certainly meant to fix the NaN case not the all-zeroes case as the associated thread alleged. As before, back-patch to all supported versions. Discussion: https://postgr.es/m/1803D792815FC24D871C00D17AE95905C71161@g01jpexmbkw24 Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/41609776f2c2869f2081439664249c9bdec83add Modified Files -------------- src/interfaces/ecpg/ecpglib/sqlda.c | 25 ++++++++++++++-------- src/interfaces/ecpg/test/expected/sql-sqlda.c | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stderr | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stdout | 8 +++---- src/interfaces/ecpg/test/sql/sqlda.pgc | 2 +- 5 files changed, 23 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. @ 2018-11-14 16:28 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-11-14 16:28 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Second try at fixing numeric data passed through an ECPG SQLDA. In commit ecfd55795, I removed sqlda.c's checks for ndigits != 0 on the grounds that we should duplicate the state of the numeric value's digit buffer even when all the digits are zeroes. However, that still isn't quite right, because another possible state of the digit buffer is buf == digits == NULL (this occurs for a NaN). As the code now stands, it'll invoke memcpy with a NULL source address and zero bytecount, which we know a few platforms crash on. Hence, reinstate the no-copy short-circuit, but make it test specifically for buf != NULL rather than some other condition. In hindsight, the ndigits test (added by commit f2ae9f9c3) was almost certainly meant to fix the NaN case not the all-zeroes case as the associated thread alleged. As before, back-patch to all supported versions. Discussion: https://postgr.es/m/1803D792815FC24D871C00D17AE95905C71161@g01jpexmbkw24 Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f9e25ba140776c01ee4bfdffc611b24a430e0872 Modified Files -------------- src/interfaces/ecpg/ecpglib/sqlda.c | 25 ++++++++++++++-------- src/interfaces/ecpg/test/expected/sql-sqlda.c | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stderr | 2 +- src/interfaces/ecpg/test/expected/sql-sqlda.stdout | 8 +++---- src/interfaces/ecpg/test/sql/sqlda.pgc | 2 +- 5 files changed, 23 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2018-11-14 16:28 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-11-14 16:28 pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. Tom Lane <tgl@sss.pgh.pa.us> 2018-11-14 16:28 pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. Tom Lane <tgl@sss.pgh.pa.us> 2018-11-14 16:28 pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. Tom Lane <tgl@sss.pgh.pa.us> 2018-11-14 16:28 pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. Tom Lane <tgl@sss.pgh.pa.us> 2018-11-14 16:28 pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. Tom Lane <tgl@sss.pgh.pa.us> 2018-11-14 16:28 pgsql: Second try at fixing numeric data passed through an ECPG SQLDA. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox