From: chalmagr <noreply@github.com>
To: pgsql-jdbc@lists.postgresql.org
Subject: [pgjdbc/pgjdbc] c59658: Fix updateable result set when there are primary k...
Date: Fri, 03 Sep 2021 03:23:06 -0700
Message-ID: <pgjdbc/pgjdbc/push/refs/heads/release/42.2/77c7d9-c59658@github.com> (raw)
Branch: refs/heads/release/42.2
Home: https://github.com/pgjdbc/pgjdbc
Commit: c596587aa52db6573d5cf41f29f1f6b8afe29cb5
https://github.com/pgjdbc/pgjdbc/commit/c596587aa52db6573d5cf41f29f1f6b8afe29cb5
Author: chalmagr <chalmagr@hotmail.com>
Date: 2021-09-03 (Fri, 03 Sep 2021)
Changed paths:
M pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
M pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java
Log Message:
-----------
Fix updateable result set when there are primary keys and unique keys (#2228)
* fix: change to updatable result set to use correctly primary or unique keys
Fix issues introduced in PR# 2199 causing problems when updating tables with PK and UK.
Originally updatable result sets support only primary keys, with the aforementioned change
and this fix unique keys are also eligible to enable updatable result set. This change will
find the better suited primary or unique key that has all the available columns in the query, but
if no match is found it will continue to fail as it used to.
Closes issue 2196
* fix: changes to updatable result set to disable use of unique keys with nullable columns
Adding logic to ensure all columns in the constraint (primary/unique) are non-nullable (always true for PKs) to guarantee 1-1 updates
* fix: removal of added code after nullable unique keys are excluded
No need to have IS NULL when nullable keys are not allowed to guarantee 1-1 updates
* fix: exclude indices with expressions for updatable result sets
Indices with expressions cannot be used (unless expression parsing / resolution
is implemented properly - currently don't see a way to get individual list elements
from pg_index.indexprs to enable proper expression filtering (pg_get_expr gives the
expression, but unable to map this to a specific attribute in the index)
Co-authored-by: Marquez Grabia, Christian <Christian.MarquezGrabia@sabre.com>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: noreply@github.com
Subject: Re: [pgjdbc/pgjdbc] c59658: Fix updateable result set when there are primary k...
In-Reply-To: <pgjdbc/pgjdbc/push/refs/heads/release/42.2/77c7d9-c59658@github.com>
References: <pgjdbc/pgjdbc/push/refs/heads/release/42.2/77c7d9-c59658@github.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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