-
-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RETURNING column name is quoted excessively #2647
Comments
I just found out, this problem occurs only when using |
Pretty sure this is a postgres jdbc driver bug. Are you using the latest driver? What version? |
Refer to #2303 |
Wow, thanks for the fast response, you guys are crazy active. I'm using |
I can't seem to be able to find the |
IMO their fix isn't ideal and it would instead be better if they didn't effectively end up double quoting the returning clause (because that is never going to be valid) ... but that is the fix they went with at this stage. |
pgjdbc references: The discussion in 2224 is probably the best background on this issue. Ultimately Postgres supports (crazy/unfortuately) things like:
Ultimately this ended up as the pgjdbc |
Ok, thanks for the detailed info. So if I understand this correctly, with the current state of afairs, if I want to use their "fix", I should use the |
@Incanus3 Yes, if you do not want |
Can confirm that after upgrading postgresql driver to v42.3 and adding |
…eConfig THEN `datasourceConfig.addProperty("quoteReturningIdentifiers", false);` I think there is not a case where we do NOT want to do this. allQuotedIdentifiers + Postgres is almost not usable without this.
Hi @jnehlmeier @Incanus3 - can you have a look at PR - #2681 ... I think we should merge that with the thinking that we effectively always want that property set with Postgres + allQuotedIdentifiers |
#2647 - When Postgres + isAllQuotedIdentifiers true + using DataSourceConfig THEN `datasourceConfig.addProperty("quoteReturningIdentifiers", false);`
Nice. But I'd almost think you want this always on with postgre - if
identifier quoting is off, why would you want to quote the returning ones?
…On Tue, May 3, 2022, 3:39 AM Rob Bygrave ***@***.***> wrote:
Closed #2647 <#2647>.
—
Reply to this email directly, view it on GitHub
<#2647 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAUGJOO74X34VF4XT6J2KLVIB7TLANCNFSM5TJSUINA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yes, when ebean quotes everything, then the property must be false. Otherwise you can not save anything through ebean. So the PR is fine. |
It's more that the Postgres JDBC driver wants to quote returning ones. As I see it, it is safer for apps not using quoted identifiers to leave them as they were. That is, I didn't really want to blanket add the config as that would be a change to applications that haven't needed that configuration property and could potentially break some apps. |
Ok, that makes sense. And the completely broken case with triple quoting is
fixed, so most people shouldn't get tripped up.
…On Tue, May 3, 2022, 12:02 PM Rob Bygrave ***@***.***> wrote:
if identifier quoting is off, why would you want to quote the returning
ones?
It's more that the Postgres JDBC driver wants to quote returning ones. As
I see it, it is safer for apps not using quoted identifiers to leave them
as they were. That is, I didn't really want to blanket add the config as
that would be a change to applications that haven't needed that
configuration property and could potentially break some apps.
—
Reply to this email directly, view it on GitHub
<#2647 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAUGJMW7WISQOW4S7MFXQDVID2SVANCNFSM5TJSUINA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Expected behavior
databaseConfig.platformConfig.allQuotedIntentifiers
is false, column name shouldn't be quoted, when true, column name should be quoted onceActual behavior
databaseConfig.platformConfig.allQuotedIntentifiers
is false, column name is quoted, when true, column name is quoted thriceSteps to reproduce
Create any entity (didn't test with other entity yet, will try to create minimal example later), use postgres
org.postgresql.Driver
, turn on SQL logging, callDatabase.save(entity)
. This is especially problematic if you set the@Id
column name to be upper-case (which we need because of other db backends), because in that case, when identifier quoting is off, it creates the columns in lower-case, but then it quotes the returning column name, so it tries to find the upper-cased name and fails. If you turn on the identifier quoting, it just fails completely, because the name is surrunded by"""
.I'm using ebean version 12.16.1. This is the persistence configuration I'm using:
And the configuration:
The entity for which it failed:
and the error output in case of
isAllQuotedIdentifiers = true
(when set to false, the RETURNING column is only quoted once, but that's not right either because it isn't qouted when running the DDL, so the case differs)There's also one other strange problem you can notice here - why does it use the
full_name
as column? It's not annotated with@Column
. And it's not quoted in the query even though quoting is on in this case.The text was updated successfully, but these errors were encountered: