diff --git a/contrib/babelfishpg_tsql/src/pltsql_coerce.c b/contrib/babelfishpg_tsql/src/pltsql_coerce.c index 358f7ffeb38..173cce469fe 100644 --- a/contrib/babelfishpg_tsql/src/pltsql_coerce.c +++ b/contrib/babelfishpg_tsql/src/pltsql_coerce.c @@ -1443,6 +1443,8 @@ resolve_numeric_typmod_from_exp(Plan *plan, Node *expr, bool *found) { /* UDT handling in T_var */ Oid immediate_base_type = get_immediate_base_type_of_UDT_internal(var->vartype); + int32 fixlen_default_typmod; + if (OidIsValid(immediate_base_type)) { int32 typmod = -1; @@ -1455,17 +1457,10 @@ resolve_numeric_typmod_from_exp(Plan *plan, Node *expr, bool *found) * Handle default typmod for supported fixed-length datatypes * such as bigint, int, smallint, and tinyint. * These typmods represent the maximum allowed digits for each type. - * - * Plan check ensures typmod consistency to preventing incorrect values, - * ensuring plan is not changed if typmod is calculated in execution stage. */ - if (plan) - { - int32 fixlen_default_typmod; - fixlen_default_typmod = get_default_typmod_for_fixedsize_dataypes(var->vartype); - if (fixlen_default_typmod != -1) - return fixlen_default_typmod; - } + fixlen_default_typmod = get_default_typmod_for_fixedsize_dataypes(var->vartype); + if (fixlen_default_typmod != -1) + return fixlen_default_typmod; if (found != NULL) *found = false; } diff --git a/test/JDBC/expected/BABEL-1164.out b/test/JDBC/expected/BABEL-1164.out index 4d6a7a5de1d..48be6277cdf 100644 --- a/test/JDBC/expected/BABEL-1164.out +++ b/test/JDBC/expected/BABEL-1164.out @@ -43,7 +43,7 @@ SELECT * FROM t2; GO ~~START~~ int#!#int#!#numeric#!#numeric -1#!#1#!#2#!#2.00000000 +1#!#1#!#2#!#2 ~~END~~ diff --git a/test/JDBC/expected/BABEL-4264.out b/test/JDBC/expected/BABEL-4264.out index f0b6eb87eda..eb13b811ee9 100644 --- a/test/JDBC/expected/BABEL-4264.out +++ b/test/JDBC/expected/BABEL-4264.out @@ -142,7 +142,7 @@ go text Query Text: SELECT * from babel4264 where dollars = 10 Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = 10) + Filter: ((dollars)::fixeddecimal(19,4) = 10) ~~END~~ ~~START~~ @@ -157,7 +157,7 @@ go text Query Text: SELECT * from babel4264 where dollars = 10.0 Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = 10.0) + Filter: ((dollars)::fixeddecimal(19,4) = 10.0) ~~END~~ ~~START~~ @@ -172,7 +172,7 @@ go text Query Text: SELECT * from babel4264 where dollars = 2147483650 Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = '2147483650'::bigint) + Filter: ((dollars)::fixeddecimal(19,4) = '2147483650'::bigint) ~~END~~ ~~START~~ @@ -187,7 +187,7 @@ go text Query Text: SELECT * from babel4264 where dollars = '10.12' Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = '10.1200'::fixeddecimal) + Filter: ((dollars)::fixeddecimal(19,4) = '10.1200'::fixeddecimal) ~~END~~ ~~START~~ @@ -202,7 +202,7 @@ go text Query Text: SELECT * from babel4264 where dollars = '10.123512341234' Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = '10.1235'::fixeddecimal) + Filter: ((dollars)::fixeddecimal(19,4) = '10.1235'::fixeddecimal) ~~END~~ ~~START~~ @@ -217,7 +217,7 @@ go text Query Text: SELECT * from babel4264 where dollars = cast('10' as varchar(30)) Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = '10.0000'::fixeddecimal) + Filter: ((dollars)::fixeddecimal(19,4) = '10.0000'::fixeddecimal) ~~END~~ ~~START~~ diff --git a/test/JDBC/expected/Numeric_Decimal_tests.out b/test/JDBC/expected/Numeric_Decimal_tests.out index eb150237550..1cc8a3e9e2a 100644 --- a/test/JDBC/expected/Numeric_Decimal_tests.out +++ b/test/JDBC/expected/Numeric_Decimal_tests.out @@ -9795,7 +9795,7 @@ text Query Text: SELECT * FROM numeric_index_test WHERE num_col = CAST(999.99 AS DECIMAL(18,2)) Index Scan using idx_composite_num_catnumeric_in0a16adf6c28603b70af9d88eead29f13 on numeric_index_test (actual rows=1 loops=1) - Index Cond: (num_col = 999.99) + Index Cond: (num_col = 999.99::numeric(18,2)) ~~END~~ @@ -9867,7 +9867,7 @@ text Query Text: SELECT * FROM numeric_index_test WHERE num_col BETWEEN 400.00 AND CAST(600.00 AS DECIMAL(18,2)) Index Scan using idx_composite_num_catnumeric_in0a16adf6c28603b70af9d88eead29f13 on numeric_index_test (actual rows=1 loops=1) - Index Cond: ((num_col >= 400.00) AND (num_col <= 600.00)) + Index Cond: ((num_col >= 400.00) AND (num_col <= 600.00::numeric(18,2))) ~~END~~ @@ -9888,11 +9888,10 @@ text Query Text: SELECT a.*, b.* FROM numeric_index_test a JOIN numeric_index_test b ON a.num_col = b.decimal_col -Merge Join (actual rows=3 loops=1) - Merge Cond: (a.num_col = (b.decimal_col)::numeric) +Nested Loop (actual rows=3 loops=1) -> Index Scan using idx_composite_num_catnumeric_in0a16adf6c28603b70af9d88eead29f13 on numeric_index_test a (actual rows=3 loops=1) - -> Materialize (actual rows=3 loops=1) - -> Index Scan using idx_decimalnumeric_index_test5d8e61a04a9662670ec1a2266602e173 on numeric_index_test b (actual rows=3 loops=1) + -> Index Scan using idx_decimalnumeric_index_test5d8e61a04a9662670ec1a2266602e173 on numeric_index_test b (actual rows=1 loops=3) + Index Cond: ((decimal_col)::numeric(18,2) = a.num_col) ~~END~~ @@ -9975,7 +9974,7 @@ text Query Text: SELECT * FROM numeric_index_test WHERE CAST(num_col AS DECIMAL(18,2)) = decimal_col Seq Scan on numeric_index_test (actual rows=3 loops=1) - Filter: ((num_col)::numeric = (decimal_col)::numeric) + Filter: (num_col = (decimal_col)::numeric(18,2)) ~~END~~ @@ -10032,7 +10031,7 @@ WHERE num_col = 123.45 AND decimal_col = 123.45 Index Scan using idx_composite_num_catnumeric_in0a16adf6c28603b70af9d88eead29f13 on numeric_index_test (actual rows=1 loops=1) Index Cond: (num_col = 123.45) - Filter: ((decimal_col)::numeric = 123.45) + Filter: ((decimal_col)::numeric(18,2) = 123.45) ~~END~~ @@ -10156,7 +10155,7 @@ text Query Text: SELECT * FROM numeric_index_test WHERE num_col * 2 = decimal_col Seq Scan on numeric_index_test (actual rows=0 loops=1) - Filter: ((num_col * '2'::numeric(1,0)) = (decimal_col)::numeric) + Filter: ((num_col * '2'::numeric(1,0)) = (decimal_col)::numeric(18,2)) Rows Removed by Filter: 4 ~~END~~ diff --git a/test/JDBC/expected/PARTITION-vu-verify.out b/test/JDBC/expected/PARTITION-vu-verify.out index 66b9d7064c0..a5e47e1b255 100644 --- a/test/JDBC/expected/PARTITION-vu-verify.out +++ b/test/JDBC/expected/PARTITION-vu-verify.out @@ -2228,7 +2228,7 @@ GO text Query Text: SELECT * FROM partition_vu_prepare_decimal_table WHERE Id >= 0.0 AND Id < 100.0 Index Scan using cda2902d769fd61eb60b1a461650212f_partition_1_id_idx on cda2902d769fd61eb60b1a461650212f_partition_1 partition_vu_prepare_decimal_table - Index Cond: (((id)::numeric >= 0.0) AND ((id)::numeric < 100.0)) + Index Cond: (((id)::numeric(10,5) >= 0.0) AND ((id)::numeric(10,5) < 100.0)) ~~END~~ ~~START~~ @@ -2259,9 +2259,9 @@ text Query Text: SELECT * FROM partition_vu_prepare_money_table WHERE Id >= 2.56789 AND Id < 3.56789 Append -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_1_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_1" partition_vu_prepare_money_table_1 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(19,4) >= 2.56789) AND ((id)::fixeddecimal(19,4) < 3.56789)) -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_0_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_0" partition_vu_prepare_money_table_2 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(19,4) >= 2.56789) AND ((id)::fixeddecimal(19,4) < 3.56789)) ~~END~~ ~~START~~ @@ -2277,9 +2277,9 @@ text Query Text: SELECT * FROM partition_vu_prepare_smallmoney_table WHERE Id >= 2.56789 AND Id < 3.56789 Append -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1" partition_vu_prepare_smallmoney_table_1 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(10,4) >= 2.56789) AND ((id)::fixeddecimal(10,4) < 3.56789)) -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0" partition_vu_prepare_smallmoney_table_2 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(10,4) >= 2.56789) AND ((id)::fixeddecimal(10,4) < 3.56789)) ~~END~~ ~~START~~ diff --git a/test/JDBC/expected/babel_datatype.out b/test/JDBC/expected/babel_datatype.out index 746d8af877c..476d7278ddc 100644 --- a/test/JDBC/expected/babel_datatype.out +++ b/test/JDBC/expected/babel_datatype.out @@ -614,7 +614,7 @@ select CAST(2 AS money) / CAST(0.5 AS decimal(4,2)); GO ~~START~~ numeric -4.0000000 +4.000000000 ~~END~~ diff --git a/test/JDBC/expected/db_collation/PARTITION-vu-verify.out b/test/JDBC/expected/db_collation/PARTITION-vu-verify.out index 9e246d4a425..2df2203d3d0 100644 --- a/test/JDBC/expected/db_collation/PARTITION-vu-verify.out +++ b/test/JDBC/expected/db_collation/PARTITION-vu-verify.out @@ -2228,7 +2228,7 @@ GO text Query Text: SELECT * FROM partition_vu_prepare_decimal_table WHERE Id >= 0.0 AND Id < 100.0 Index Scan using cda2902d769fd61eb60b1a461650212f_partition_1_id_idx on cda2902d769fd61eb60b1a461650212f_partition_1 partition_vu_prepare_decimal_table - Index Cond: (((id)::numeric >= 0.0) AND ((id)::numeric < 100.0)) + Index Cond: (((id)::numeric(10,5) >= 0.0) AND ((id)::numeric(10,5) < 100.0)) ~~END~~ ~~START~~ @@ -2259,9 +2259,9 @@ text Query Text: SELECT * FROM partition_vu_prepare_money_table WHERE Id >= 2.56789 AND Id < 3.56789 Append -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_1_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_1" partition_vu_prepare_money_table_1 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(19,4) >= 2.56789) AND ((id)::fixeddecimal(19,4) < 3.56789)) -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_0_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_0" partition_vu_prepare_money_table_2 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(19,4) >= 2.56789) AND ((id)::fixeddecimal(19,4) < 3.56789)) ~~END~~ ~~START~~ @@ -2277,9 +2277,9 @@ text Query Text: SELECT * FROM partition_vu_prepare_smallmoney_table WHERE Id >= 2.56789 AND Id < 3.56789 Append -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1" partition_vu_prepare_smallmoney_table_1 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(10,4) >= 2.56789) AND ((id)::fixeddecimal(10,4) < 3.56789)) -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0" partition_vu_prepare_smallmoney_table_2 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(10,4) >= 2.56789) AND ((id)::fixeddecimal(10,4) < 3.56789)) ~~END~~ ~~START~~ diff --git a/test/JDBC/expected/money_smallmoney-vu-verify.out b/test/JDBC/expected/money_smallmoney-vu-verify.out index f5ec7d2d048..716a93576a8 100644 --- a/test/JDBC/expected/money_smallmoney-vu-verify.out +++ b/test/JDBC/expected/money_smallmoney-vu-verify.out @@ -156,7 +156,7 @@ GO text Query Text: SELECT * FROM money_smallmoney_vu_test WHERE cost_sm BETWEEN 100 and 200 Index Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: (((cost_sm)::fixeddecimal >= 100) AND ((cost_sm)::fixeddecimal <= 200)) + Index Cond: (((cost_sm)::fixeddecimal(10,4) >= 100) AND ((cost_sm)::fixeddecimal(10,4) <= 200)) ~~END~~ ~~START~~ @@ -188,7 +188,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_sm <= CAST(50 AS SMALLMONEY) + CAST(50 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: (cost_sm <= ((('50.0000'::fixeddecimal(10,4))::smallmoney(655368) + ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_sm <= ((('50.0000'::fixeddecimal(10,4))::smallmoney(655368) + ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -204,7 +204,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_sm = CAST(2 AS INT) * CAST(50 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: (cost_sm = ((2 * ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_sm = ((2 * ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -220,7 +220,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_sm > CAST(200 AS INT) / CAST(2 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: (cost_sm > ((200 / ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_sm > ((200 / ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -235,7 +235,7 @@ GO text Query Text: SELECT cost_sm FROM money_smallmoney_vu_test WHERE cost_sm <= CAST(200 AS BIGINT) * CAST(2 AS SMALLMONEY) Index Only Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: (cost_sm <= (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_sm <= (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -250,7 +250,7 @@ GO text Query Text: SELECT * FROM money_smallmoney_vu_test WHERE cost_sm < CAST(200 AS BIGINT) * CAST(2 AS SMALLMONEY) Index Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: ((cost_sm)::fixeddecimal < (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: ((cost_sm)::fixeddecimal(10,4) < (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -265,7 +265,7 @@ GO text Query Text: SELECT * FROM money_smallmoney_vu_test WHERE cost_m BETWEEN 100 and 200 Index Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: (((cost_m)::fixeddecimal >= 100) AND ((cost_m)::fixeddecimal <= 200)) + Index Cond: (((cost_m)::fixeddecimal(19,4) >= 100) AND ((cost_m)::fixeddecimal(19,4) <= 200)) ~~END~~ ~~START~~ @@ -297,7 +297,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_m >= CAST(50 AS SMALLMONEY) + CAST(50 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: (cost_m >= ((('50.0000'::fixeddecimal(10,4))::smallmoney(655368) + ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_m >= ((('50.0000'::fixeddecimal(10,4))::smallmoney(655368) + ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -313,7 +313,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_m = CAST(2 AS INT) * CAST(50 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: (cost_m = ((2 * ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_m = ((2 * ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -329,7 +329,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_m < CAST(200 AS INT) / CAST(2 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: (cost_m < ((200 / ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_m < ((200 / ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -344,7 +344,7 @@ GO text Query Text: SELECT cost_m FROM money_smallmoney_vu_test WHERE cost_m < CAST(200 AS BIGINT) * CAST(2 AS SMALLMONEY) Index Only Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: (cost_m < (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_m < (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -359,7 +359,7 @@ GO text Query Text: SELECT * FROM money_smallmoney_vu_test WHERE cost_m > CAST(200 AS BIGINT) * CAST(2 AS SMALLMONEY) Index Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: ((cost_m)::fixeddecimal > (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: ((cost_m)::fixeddecimal(19,4) > (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/PARTITION-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/PARTITION-vu-verify.out index c6c6c166903..76d533bd181 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/PARTITION-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/PARTITION-vu-verify.out @@ -2228,7 +2228,7 @@ GO text Query Text: SELECT * FROM partition_vu_prepare_decimal_table WHERE Id >= 0.0 AND Id < 100.0 Index Scan using cda2902d769fd61eb60b1a461650212f_partition_1_id_idx on cda2902d769fd61eb60b1a461650212f_partition_1 partition_vu_prepare_decimal_table - Index Cond: (((id)::numeric >= 0.0) AND ((id)::numeric < 100.0)) + Index Cond: (((id)::numeric(10,5) >= 0.0) AND ((id)::numeric(10,5) < 100.0)) ~~END~~ ~~START~~ @@ -2259,9 +2259,9 @@ text Query Text: SELECT * FROM partition_vu_prepare_money_table WHERE Id >= 2.56789 AND Id < 3.56789 Append -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_1_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_1" partition_vu_prepare_money_table_1 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(19,4) >= 2.56789) AND ((id)::fixeddecimal(19,4) < 3.56789)) -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_0_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_0" partition_vu_prepare_money_table_2 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(19,4) >= 2.56789) AND ((id)::fixeddecimal(19,4) < 3.56789)) ~~END~~ ~~START~~ @@ -2277,9 +2277,9 @@ text Query Text: SELECT * FROM partition_vu_prepare_smallmoney_table WHERE Id >= 2.56789 AND Id < 3.56789 Append -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1" partition_vu_prepare_smallmoney_table_1 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(10,4) >= 2.56789) AND ((id)::fixeddecimal(10,4) < 3.56789)) -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0" partition_vu_prepare_smallmoney_table_2 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(10,4) >= 2.56789) AND ((id)::fixeddecimal(10,4) < 3.56789)) ~~END~~ ~~START~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_datatype.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_datatype.out index ee069525137..ef7b0b7e0da 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_datatype.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_datatype.out @@ -614,7 +614,7 @@ select CAST(2 AS money) / CAST(0.5 AS decimal(4,2)); GO ~~START~~ numeric -4.0000000 +4.000000000 ~~END~~ diff --git a/test/JDBC/expected/parallel_query/BABEL-4264.out b/test/JDBC/expected/parallel_query/BABEL-4264.out index 78d4bc2f5d3..90fb01072a7 100644 --- a/test/JDBC/expected/parallel_query/BABEL-4264.out +++ b/test/JDBC/expected/parallel_query/BABEL-4264.out @@ -152,7 +152,7 @@ Query Text: SELECT * from babel4264 where dollars = 10 Gather Workers Planned: 3 -> Parallel Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = 10) + Filter: ((dollars)::fixeddecimal(19,4) = 10) ~~END~~ ~~START~~ @@ -169,7 +169,7 @@ Query Text: SELECT * from babel4264 where dollars = 10.0 Gather Workers Planned: 3 -> Parallel Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = 10.0) + Filter: ((dollars)::fixeddecimal(19,4) = 10.0) ~~END~~ ~~START~~ @@ -186,7 +186,7 @@ Query Text: SELECT * from babel4264 where dollars = 2147483650 Gather Workers Planned: 3 -> Parallel Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = '2147483650'::bigint) + Filter: ((dollars)::fixeddecimal(19,4) = '2147483650'::bigint) ~~END~~ ~~START~~ @@ -203,7 +203,7 @@ Query Text: SELECT * from babel4264 where dollars = '10.12' Gather Workers Planned: 3 -> Parallel Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = '10.1200'::fixeddecimal) + Filter: ((dollars)::fixeddecimal(19,4) = '10.1200'::fixeddecimal) ~~END~~ ~~START~~ @@ -220,7 +220,7 @@ Query Text: SELECT * from babel4264 where dollars = '10.123512341234' Gather Workers Planned: 3 -> Parallel Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = '10.1235'::fixeddecimal) + Filter: ((dollars)::fixeddecimal(19,4) = '10.1235'::fixeddecimal) ~~END~~ ~~START~~ @@ -237,7 +237,7 @@ Query Text: SELECT * from babel4264 where dollars = cast('10' as varchar(30)) Gather Workers Planned: 3 -> Parallel Seq Scan on babel4264 - Filter: ((dollars)::fixeddecimal = '10.0000'::fixeddecimal) + Filter: ((dollars)::fixeddecimal(19,4) = '10.0000'::fixeddecimal) ~~END~~ ~~START~~ diff --git a/test/JDBC/expected/parallel_query/Numeric_Decimal_tests.out b/test/JDBC/expected/parallel_query/Numeric_Decimal_tests.out index 16d633dea7f..60021cbf271 100644 --- a/test/JDBC/expected/parallel_query/Numeric_Decimal_tests.out +++ b/test/JDBC/expected/parallel_query/Numeric_Decimal_tests.out @@ -9807,7 +9807,7 @@ Gather (actual rows=1 loops=1) Workers Launched: 1 Single Copy: true -> Index Scan using idx_composite_num_catnumeric_in0a16adf6c28603b70af9d88eead29f13 on numeric_index_test (actual rows=1 loops=1) - Index Cond: (num_col = 999.99) + Index Cond: (num_col = 999.99::numeric(18,2)) ~~END~~ @@ -9891,7 +9891,7 @@ Gather (actual rows=1 loops=1) Workers Launched: 1 Single Copy: true -> Index Scan using idx_composite_num_catnumeric_in0a16adf6c28603b70af9d88eead29f13 on numeric_index_test (actual rows=1 loops=1) - Index Cond: ((num_col >= 400.00) AND (num_col <= 600.00)) + Index Cond: ((num_col >= 400.00) AND (num_col <= 600.00::numeric(18,2))) ~~END~~ @@ -9915,11 +9915,10 @@ JOIN numeric_index_test b ON a.num_col = b.decimal_col Gather (actual rows=3 loops=1) Workers Planned: 1 Workers Launched: 1 - -> Merge Join (actual rows=2 loops=2) - Merge Cond: (a.num_col = (b.decimal_col)::numeric) + -> Nested Loop (actual rows=2 loops=2) -> Parallel Index Scan using idx_composite_num_catnumeric_in0a16adf6c28603b70af9d88eead29f13 on numeric_index_test a (actual rows=2 loops=2) - -> Materialize (actual rows=3 loops=1) - -> Index Scan using idx_decimalnumeric_index_test5d8e61a04a9662670ec1a2266602e173 on numeric_index_test b (actual rows=3 loops=1) + -> Index Scan using idx_decimalnumeric_index_test5d8e61a04a9662670ec1a2266602e173 on numeric_index_test b (actual rows=1 loops=3) + Index Cond: ((decimal_col)::numeric(18,2) = a.num_col) ~~END~~ @@ -10018,7 +10017,7 @@ Gather (actual rows=3 loops=1) Workers Launched: 1 Single Copy: true -> Seq Scan on numeric_index_test (actual rows=3 loops=1) - Filter: ((num_col)::numeric = (decimal_col)::numeric) + Filter: (num_col = (decimal_col)::numeric(18,2)) ~~END~~ @@ -10087,7 +10086,7 @@ Gather (actual rows=1 loops=1) Single Copy: true -> Index Scan using idx_composite_num_catnumeric_in0a16adf6c28603b70af9d88eead29f13 on numeric_index_test (actual rows=1 loops=1) Index Cond: (num_col = 123.45) - Filter: ((decimal_col)::numeric = 123.45) + Filter: ((decimal_col)::numeric(18,2) = 123.45) ~~END~~ @@ -10230,7 +10229,7 @@ Gather (actual rows=0 loops=1) Workers Launched: 1 Single Copy: true -> Seq Scan on numeric_index_test (actual rows=0 loops=1) - Filter: ((num_col * '2'::numeric(1,0)) = (decimal_col)::numeric) + Filter: ((num_col * '2'::numeric(1,0)) = (decimal_col)::numeric(18,2)) Rows Removed by Filter: 4 ~~END~~ diff --git a/test/JDBC/expected/parallel_query/PARTITION-vu-verify.out b/test/JDBC/expected/parallel_query/PARTITION-vu-verify.out index 229b61a0cdb..a1befcdf694 100644 --- a/test/JDBC/expected/parallel_query/PARTITION-vu-verify.out +++ b/test/JDBC/expected/parallel_query/PARTITION-vu-verify.out @@ -2298,7 +2298,7 @@ Gather Workers Planned: 1 Single Copy: true -> Index Scan using cda2902d769fd61eb60b1a461650212f_partition_1_id_idx on cda2902d769fd61eb60b1a461650212f_partition_1 partition_vu_prepare_decimal_table - Index Cond: (((id)::numeric >= 0.0) AND ((id)::numeric < 100.0)) + Index Cond: (((id)::numeric(10,5) >= 0.0) AND ((id)::numeric(10,5) < 100.0)) ~~END~~ ~~START~~ @@ -2335,9 +2335,9 @@ Gather Single Copy: true -> Append -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_1_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_1" partition_vu_prepare_money_table_1 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(19,4) >= 2.56789) AND ((id)::fixeddecimal(19,4) < 3.56789)) -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_0_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_0" partition_vu_prepare_money_table_2 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(19,4) >= 2.56789) AND ((id)::fixeddecimal(19,4) < 3.56789)) ~~END~~ ~~START~~ @@ -2356,9 +2356,9 @@ Gather Single Copy: true -> Append -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1" partition_vu_prepare_smallmoney_table_1 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(10,4) >= 2.56789) AND ((id)::fixeddecimal(10,4) < 3.56789)) -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0" partition_vu_prepare_smallmoney_table_2 - Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + Index Cond: (((id)::fixeddecimal(10,4) >= 2.56789) AND ((id)::fixeddecimal(10,4) < 3.56789)) ~~END~~ ~~START~~ diff --git a/test/JDBC/expected/parallel_query/money_smallmoney-vu-verify.out b/test/JDBC/expected/parallel_query/money_smallmoney-vu-verify.out index 1d12ba5b80f..53debb32fab 100644 --- a/test/JDBC/expected/parallel_query/money_smallmoney-vu-verify.out +++ b/test/JDBC/expected/parallel_query/money_smallmoney-vu-verify.out @@ -159,7 +159,7 @@ Gather Workers Planned: 1 Single Copy: true -> Index Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: (((cost_sm)::fixeddecimal >= 100) AND ((cost_sm)::fixeddecimal <= 200)) + Index Cond: (((cost_sm)::fixeddecimal(10,4) >= 100) AND ((cost_sm)::fixeddecimal(10,4) <= 200)) ~~END~~ ~~START~~ @@ -194,7 +194,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_sm <= CAST(50 AS SMALLMONEY) + CAST(50 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: (cost_sm <= ((('50.0000'::fixeddecimal(10,4))::smallmoney(655368) + ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_sm <= ((('50.0000'::fixeddecimal(10,4))::smallmoney(655368) + ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -210,7 +210,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_sm = CAST(2 AS INT) * CAST(50 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: (cost_sm = ((2 * ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_sm = ((2 * ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -226,7 +226,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_sm > CAST(200 AS INT) / CAST(2 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: (cost_sm > ((200 / ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_sm > ((200 / ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -241,7 +241,7 @@ GO text Query Text: SELECT cost_sm FROM money_smallmoney_vu_test WHERE cost_sm <= CAST(200 AS BIGINT) * CAST(2 AS SMALLMONEY) Index Only Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: (cost_sm <= (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_sm <= (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -256,7 +256,7 @@ GO text Query Text: SELECT * FROM money_smallmoney_vu_test WHERE cost_sm < CAST(200 AS BIGINT) * CAST(2 AS SMALLMONEY) Index Scan using idx_cost_smallmoneymoney_smallm763569c9206bb1e36c4670199725a26c on money_smallmoney_vu_test - Index Cond: ((cost_sm)::fixeddecimal < (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: ((cost_sm)::fixeddecimal(10,4) < (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -274,7 +274,7 @@ Gather Workers Planned: 1 Single Copy: true -> Index Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: (((cost_m)::fixeddecimal >= 100) AND ((cost_m)::fixeddecimal <= 200)) + Index Cond: (((cost_m)::fixeddecimal(19,4) >= 100) AND ((cost_m)::fixeddecimal(19,4) <= 200)) ~~END~~ ~~START~~ @@ -309,7 +309,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_m >= CAST(50 AS SMALLMONEY) + CAST(50 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: (cost_m >= ((('50.0000'::fixeddecimal(10,4))::smallmoney(655368) + ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_m >= ((('50.0000'::fixeddecimal(10,4))::smallmoney(655368) + ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -325,7 +325,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_m = CAST(2 AS INT) * CAST(50 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: (cost_m = ((2 * ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_m = ((2 * ('50.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -341,7 +341,7 @@ text Query Text: SELECT COUNT(*) FROM money_smallmoney_vu_test WHERE cost_m < CAST(200 AS INT) / CAST(2 AS SMALLMONEY) Aggregate -> Index Only Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: (cost_m < ((200 / ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_m < ((200 / ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -356,7 +356,7 @@ GO text Query Text: SELECT cost_m FROM money_smallmoney_vu_test WHERE cost_m < CAST(200 AS BIGINT) * CAST(2 AS SMALLMONEY) Index Only Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: (cost_m < (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: (cost_m < (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ @@ -371,7 +371,7 @@ GO text Query Text: SELECT * FROM money_smallmoney_vu_test WHERE cost_m > CAST(200 AS BIGINT) * CAST(2 AS SMALLMONEY) Index Scan using idx_cost_moneymoney_smallmoney_561673fc5dd7f27d48118a464f7209db on money_smallmoney_vu_test - Index Cond: ((cost_m)::fixeddecimal > (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal) + Index Cond: ((cost_m)::fixeddecimal(19,4) > (('200'::bigint * ('2.0000'::fixeddecimal(10,4))::smallmoney(655368)))::fixeddecimal(10,4)) ~~END~~ ~~START~~ diff --git a/test/JDBC/expected/unpivot-vu-verify.out b/test/JDBC/expected/unpivot-vu-verify.out index f6c009f36fb..5cf122ff764 100644 --- a/test/JDBC/expected/unpivot-vu-verify.out +++ b/test/JDBC/expected/unpivot-vu-verify.out @@ -1152,9 +1152,9 @@ UNPIVOT ( adjusted_turnover FOR quarter IN (q1_adj, [q3 adj])) AS u; GO ~~START~~ int#!#char#!#numeric#!#numeric#!#nvarchar -3#!#R#!#0.0#!#440.00000000#!#q3 adj -1#!#R#!#220.0#!#110.00000000#!#q1_adj -1#!#R#!#220.0#!#110.00000000#!#q3 adj +3#!#R#!#0.0#!#440.0#!#q3 adj +1#!#R#!#220.0#!#110.0#!#q1_adj +1#!#R#!#220.0#!#110.0#!#q3 adj ~~END~~