Skip to content

Commit

Permalink
[pg15] merge: pg15-upgrade into pg15
Browse files Browse the repository at this point in the history
Summary:
Development of pg15-upgrade will continue in the pg15 branch.

Automatic merge
  • Loading branch information
foucher committed Oct 1, 2024
2 parents 6623c35 + e40955b commit 8ac3e00
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
2 changes: 1 addition & 1 deletion managed/src/main/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.25.0.1501-b0
2.25.0.1500-b0
1 change: 1 addition & 0 deletions pg15_tests/passing_tests.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ JAVA org.yb.pgsql.TestPgRegressTypesGeo
JAVA org.yb.pgsql.TestPgRegressTypesMisc
JAVA org.yb.pgsql.TestPgRegressTypesString
JAVA org.yb.pgsql.TestPgRegressTypesUDT
JAVA org.yb.pgsql.TestPgRegressUpdateOptimized
JAVA org.yb.pgsql.TestPgRegressWindow
JAVA org.yb.pgsql.TestPgRegressYbExtensionsYbXclusterDdlReplication
JAVA org.yb.pgsql.TestPgRegressYbFetchLimits
Expand Down
10 changes: 10 additions & 0 deletions src/postgres/src/backend/optimizer/plan/createplan.c
Original file line number Diff line number Diff line change
Expand Up @@ -3389,6 +3389,7 @@ yb_single_row_update_or_delete_path(PlannerInfo *root,
foreach (values, build_path_tlist(root, (Path *) projection_path))
{
TargetEntry *tle = lfirst_node(TargetEntry, values);
AttrNumber varattno = InvalidAttrNumber;

/* Ignore junk columns. */
if (IsA(tle->expr, Var))
Expand All @@ -3401,6 +3402,8 @@ yb_single_row_update_or_delete_path(PlannerInfo *root,
{
continue;
}

varattno = var->varattno;
}

/*
Expand Down Expand Up @@ -3445,6 +3448,13 @@ yb_single_row_update_or_delete_path(PlannerInfo *root,
int resno = tle->resno =
list_nth_int(update_colnos, update_col_index++);

/*
* If the column is set to itself (SET col = col), it will not
* get updated. So it has no impact on single row computation.
*/
if (varattno == tle->resno)
continue;

/* Updates involving primary key columns are not single-row. */
if (bms_is_member(resno - attr_offset, primary_key_attrs))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,9 +847,20 @@ EXPLAIN (ANALYZE, DIST, COSTS OFF) UPDATE geometric_types_table SET v1 = 1, v5 =

-- Alterate representations of a circle
EXPLAIN (ANALYZE, DIST, COSTS OFF) UPDATE geometric_types_table SET v1 = 1, v8 = '(1, 2), 3'::circle WHERE h = 1;
ERROR: invalid input syntax for type circle: "(1, 2), 3"
LINE 1: ...FF) UPDATE geometric_types_table SET v1 = 1, v8 = '(1, 2), 3...
^
QUERY PLAN
----------------------------------------------------------------------------------------------------
Update on geometric_types_table (actual rows=0 loops=1)
-> Index Scan using geometric_types_table_pkey on geometric_types_table (actual rows=1 loops=1)
Index Cond: (h = 1)
Storage Table Read Requests: 1
Storage Table Rows Scanned: 1
Storage Table Write Requests: 1
Storage Read Requests: 1
Storage Rows Scanned: 1
Storage Write Requests: 1
Storage Flush Requests: 1
(10 rows)

EXPLAIN (ANALYZE, DIST, COSTS OFF) UPDATE geometric_types_table SET v1 = 1, v8 = '((1, 2), 3)'::circle WHERE h = 1;
QUERY PLAN
----------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -994,6 +1005,7 @@ EXPLAIN (ANALYZE, DIST, COSTS OFF) UPDATE array_types_table SET v1 = 1, v2[2:3]
-- Test for type modifiers
-- REAL has 6 decimal digits of precision, NUMERIC has type modifiers 'precision' and 'scale'.
-- Precision is the total number of digits, scale is the number of digits after the decimal point.
SET extra_float_digits TO 0;
CREATE TABLE numeric_table (h INT PRIMARY KEY, v1 REAL, v2 NUMERIC(4, 2), v3 NUMERIC(10, 4), v4 FLOAT4);
CREATE INDEX NONCONCURRENTLY ON numeric_table (v1) INCLUDE (v2, v3, v4);
INSERT INTO numeric_table VALUES (1, 1.234567, 12.34, 1.234567, 1.23456789012);
Expand Down Expand Up @@ -1040,9 +1052,8 @@ EXPLAIN (ANALYZE, DIST, COSTS OFF) UPDATE numeric_table SET v1 = 1.2345670, v2 =
-- Casting from infinity to infinity should not cause a change in representation.
-- Note that NUMERIC does not support infinity prior to PG 14.
INSERT INTO numeric_table VALUES (2, 'inf', 'Infinity', '-Infinity', '-inf');
ERROR: invalid input syntax for type numeric: "Infinity"
LINE 1: INSERT INTO numeric_table VALUES (2, 'inf', 'Infinity', '-In...
^
ERROR: numeric field overflow
DETAIL: A field with precision 4, scale 2 cannot hold an infinite value.
INSERT INTO numeric_table VALUES (2, 'inf', 0, 0, '-inf');
EXPLAIN (ANALYZE, DIST, COSTS OFF) UPDATE numeric_table SET v1 = 'inf'::real + 1, v4 = '-Infinity'::float4 + 1 WHERE h = 2;
QUERY PLAN
Expand Down Expand Up @@ -1536,3 +1547,4 @@ DROP TABLE numeric_table;
DROP TABLE array_types_table;
DROP TABLE geometric_types_table;
DROP TABLE json_types_table;
RESET extra_float_digits;
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ EXPLAIN (ANALYZE, DIST, COSTS OFF) UPDATE array_types_table SET v1 = 1, v2[2:3]
-- Test for type modifiers
-- REAL has 6 decimal digits of precision, NUMERIC has type modifiers 'precision' and 'scale'.
-- Precision is the total number of digits, scale is the number of digits after the decimal point.
SET extra_float_digits TO 0;
CREATE TABLE numeric_table (h INT PRIMARY KEY, v1 REAL, v2 NUMERIC(4, 2), v3 NUMERIC(10, 4), v4 FLOAT4);
CREATE INDEX NONCONCURRENTLY ON numeric_table (v1) INCLUDE (v2, v3, v4);
INSERT INTO numeric_table VALUES (1, 1.234567, 12.34, 1.234567, 1.23456789012);
Expand Down Expand Up @@ -280,3 +281,5 @@ DROP TABLE numeric_table;
DROP TABLE array_types_table;
DROP TABLE geometric_types_table;
DROP TABLE json_types_table;

RESET extra_float_digits;

0 comments on commit 8ac3e00

Please sign in to comment.