diff --git a/contrib/babelfishpg_money/fixeddecimal.c b/contrib/babelfishpg_money/fixeddecimal.c index 257d457399..9cfd4e3520 100755 --- a/contrib/babelfishpg_money/fixeddecimal.c +++ b/contrib/babelfishpg_money/fixeddecimal.c @@ -2984,6 +2984,9 @@ fixeddecimalaggstateserialize(PG_FUNCTION_ARGS) if (!AggCheckCallContext(fcinfo, NULL)) elog(ERROR, "aggregate function called in non-aggregate context"); + if (PG_ARGISNULL(0)) + PG_RETURN_NULL(); + state = (FixedDecimalAggState *) PG_GETARG_POINTER(0); pq_begintypsend(&buf); @@ -3009,6 +3012,9 @@ fixeddecimalaggstatedeserialize(PG_FUNCTION_ARGS) if (!AggCheckCallContext(fcinfo, NULL)) elog(ERROR, "aggregate function called in non-aggregate context"); + if (PG_ARGISNULL(0)) + PG_RETURN_NULL(); + sstate = PG_GETARG_BYTEA_P(0); /* diff --git a/test/JDBC/expected/BABEL-4261.out b/test/JDBC/expected/BABEL-4261.out new file mode 100644 index 0000000000..c917bc7d14 --- /dev/null +++ b/test/JDBC/expected/BABEL-4261.out @@ -0,0 +1,84 @@ +CREATE TABLE t1_babel4261 (a money); +GO + +BEGIN TRAN BABEL4261_T1; +GO + +ALTER TABLE t1_babel4261 SET (parallel_workers = 16); -- note: this is PG syntax, not T-SQL +GO + +-- The third parameter is true to set config back to default after transaction is committed +SELECT set_config('force_parallel_mode', '1', true) +SELECT set_config('parallel_setup_cost', '0', true) +SELECT set_config('parallel_tuple_cost', '0', true) +GO +~~START~~ +text +on +~~END~~ + +~~START~~ +text +0 +~~END~~ + +~~START~~ +text +0 +~~END~~ + + +--- INSERT SOME data into t1_babel4261 +INSERT t1_babel4261 SELECT 0.4245*10000 +INSERT t1_babel4261 SELECT 0.5234*10000 +INSERT t1_babel4261 SELECT 0.1113*10000 +INSERT t1_babel4261 SELECT 0.6732*10000 +INSERT t1_babel4261 SELECT 0.3467*10000 +INSERT t1_babel4261 SELECT 0.5213*10000 +INSERT t1_babel4261 SELECT 0.9893*10000 +INSERT t1_babel4261 SELECT 0.6034*10000 +INSERT t1_babel4261 SELECT 0.3334*10000 +INSERT t1_babel4261 SELECT 0.8888*10000 +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +SELECT sum(a) FROM t1_babel4261 +SELECT sum(a) FROM t1_babel4261 -- should not crash +GO +~~START~~ +money +54153.0000 +~~END~~ + +~~START~~ +money +54153.0000 +~~END~~ + + +-- Commiting sets force_parallel_mode, parallel_setup_cost, parallel_tuple_cost back to default +COMMIT TRAN BABEL4261_T1; +GO + +DROP TABLE t1_babel4261; +GO + diff --git a/test/JDBC/input/BABEL-4261.sql b/test/JDBC/input/BABEL-4261.sql new file mode 100644 index 0000000000..3f06816453 --- /dev/null +++ b/test/JDBC/input/BABEL-4261.sql @@ -0,0 +1,39 @@ +CREATE TABLE t1_babel4261 (a money); +GO + +BEGIN TRAN BABEL4261_T1; +GO + +ALTER TABLE t1_babel4261 SET (parallel_workers = 16); -- note: this is PG syntax, not T-SQL +GO + +-- The third parameter is true to set config back to default after transaction is committed +SELECT set_config('force_parallel_mode', '1', true) +SELECT set_config('parallel_setup_cost', '0', true) +SELECT set_config('parallel_tuple_cost', '0', true) +GO + +--- INSERT SOME data into t1_babel4261 +INSERT t1_babel4261 SELECT 0.4245*10000 +INSERT t1_babel4261 SELECT 0.5234*10000 +INSERT t1_babel4261 SELECT 0.1113*10000 +INSERT t1_babel4261 SELECT 0.6732*10000 +INSERT t1_babel4261 SELECT 0.3467*10000 +INSERT t1_babel4261 SELECT 0.5213*10000 +INSERT t1_babel4261 SELECT 0.9893*10000 +INSERT t1_babel4261 SELECT 0.6034*10000 +INSERT t1_babel4261 SELECT 0.3334*10000 +INSERT t1_babel4261 SELECT 0.8888*10000 +GO + +SELECT sum(a) FROM t1_babel4261 +SELECT sum(a) FROM t1_babel4261 -- should not crash +GO + +-- Commiting sets force_parallel_mode, parallel_setup_cost, parallel_tuple_cost back to default +COMMIT TRAN BABEL4261_T1; +GO + +DROP TABLE t1_babel4261; +GO + diff --git a/test/JDBC/parallel_query_jdbc_schedule b/test/JDBC/parallel_query_jdbc_schedule index 1a11916c18..bfa92634b2 100644 --- a/test/JDBC/parallel_query_jdbc_schedule +++ b/test/JDBC/parallel_query_jdbc_schedule @@ -307,9 +307,6 @@ ignore#!#Test-sp_addrolemember-dep-vu-verify ignore#!#Test-sp_droprolemember-dep-vu-verify ignore#!#babel_table_type -# BABEL-4422 -ignore#!#babel_money - # BABEL-4423 ignore#!#BABEL-IDENTITY