diff options
| author | Ashutosh Bapat | 2011-06-15 04:16:47 +0000 |
|---|---|---|
| committer | Ashutosh Bapat | 2011-06-15 04:27:14 +0000 |
| commit | bcfa7b115f2a76e0146016dee36995df6eab89d0 (patch) | |
| tree | ddd5dc4e39b8ad305e96fd6c61883f9dd41fa18c /src | |
| parent | ca34131f203bfc21c57b928b0fc3fd6ccef0195c (diff) | |
Fix for bug 3286054. The aggregates like count() can return integral value 0,
which is equivalent to (Datum)NULL. We should not return NULL tuple when we
encounter integral value 0 as aggregation result in ExecRemoteQuery().
For aggregate count(), the initial collection value should be 0 just like the
initial transition value.
Diffstat (limited to 'src')
| -rw-r--r-- | src/backend/pgxc/pool/execRemote.c | 14 | ||||
| -rw-r--r-- | src/include/catalog/pg_aggregate.h | 4 | ||||
| -rw-r--r-- | src/test/regress/expected/tsearch_1.out | 12 |
3 files changed, 10 insertions, 20 deletions
diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c index 0a2e6deca8..ee02109a82 100644 --- a/src/backend/pgxc/pool/execRemote.c +++ b/src/backend/pgxc/pool/execRemote.c @@ -3764,22 +3764,8 @@ handle_results: */ if (node->simple_aggregates) { - int i, natts; - finish_simple_aggregates(node, resultslot); - /* - * PGXCTODO :In fact exec_simple_aggregates & finish_simple_aggregates - * should not be resulting in a TupleTableSlot with NULL pointer in - * per attribute value, but for now to fix the crash this check would do - */ - natts = resultslot->tts_tupleDescriptor->natts; - for (i = 0; i < natts; ++i) - { - if (resultslot->tts_values[i] == (Datum) NULL) - return NULL; - } - if (!TupIsNull(resultslot)) have_tuple = true; } diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h index 5c9886332f..d53a632d3d 100644 --- a/src/include/catalog/pg_aggregate.h +++ b/src/include/catalog/pg_aggregate.h @@ -241,8 +241,8 @@ DATA(insert ( 3527 enum_smaller enum_smaller - 3518 3500 3500 _null_ _null_ ) /* count */ /* Final function is data type conversion function numeric_int8 is refernced by OID because of ambiguous defininition in pg_proc */ #ifdef PGXC -DATA(insert ( 2147 int8inc_any int8_sum_to_int8 - 0 20 20 "0" _null_ )); -DATA(insert ( 2803 int8inc int8_sum_to_int8 - 0 20 20 "0" _null_ )); +DATA(insert ( 2147 int8inc_any int8_sum_to_int8 - 0 20 20 "0" "0" )); +DATA(insert ( 2803 int8inc int8_sum_to_int8 - 0 20 20 "0" "0" )); #endif #ifdef PGXC //DATA(insert ( 2147 int8inc_any - 0 20 "0" )); diff --git a/src/test/regress/expected/tsearch_1.out b/src/test/regress/expected/tsearch_1.out index 4d1f1b131a..94238cbf06 100644 --- a/src/test/regress/expected/tsearch_1.out +++ b/src/test/regress/expected/tsearch_1.out @@ -1045,26 +1045,30 @@ DETAIL: The feature is not currently supported SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); count ------- -(0 rows) + 0 +(1 row) INSERT INTO test_tsvector (t) VALUES ('345 qwerty'); SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); count ------- -(0 rows) + 0 +(1 row) UPDATE test_tsvector SET t = null WHERE t = '345 qwerty'; ERROR: Partition column can't be updated in current version SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); count ------- -(0 rows) + 0 +(1 row) INSERT INTO test_tsvector (t) VALUES ('345 qwerty'); SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); count ------- -(0 rows) + 0 +(1 row) -- test finding items in GIN's pending list create table pendtest (ts tsvector); |
