-
Notifications
You must be signed in to change notification settings - Fork 2.3k
time_zone DSN parameter value requires quoting #405
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
Comments
Set the timezone in the DSN, and add quoting. See go-sql-driver/mysql#405
Right below: "The values must be url.QueryEscape'ed!" |
Sorry, quoted not escaped. That was a little too fast.. |
Even though it feels unnatural, I don't think there is much we can do about it. So we have to fix the documentation. Any suggestions how to phrase it? |
How about https://github.com/go-sql-driver/mysql/blob/master/connection.go#L55 -> |
@arnehormann Too late. Code in the wild is already relying on the existing behaviour. That's what happens when issues are reviewed 10 months after the report. I'm writing a documentation patch. |
@dolmen we can also detect if it starts quoted and only apply this otherwise... |
Improve documentation of quoting rules for system var values in DSN. go-sql-driver#405
@arnehormann a full fix would also have to take care of also handling quotes quoted inside the value. |
as I said: just with an alternative to Quote hitting all must-be-escaped MySQL chars |
By me, licensed CC0 - public domain:
|
@arnehormann I already have production code that has |
I did acknowledge it. I just didn't write the fix yet. |
@dolmen I can't fully dig into it right now, but something along these lines should fix it: arnehormann@aed6b36 I'd appreciate if you could test it and get back to us. |
Improve documentation of quoting rules for system var values in DSN. go-sql-driver#405
Improve documentation of quoting rules for system var values in DSN. go-sql-driver#405
To set the
time_zone
from the DSN, the value must be quoted. But this is not correctly documented.Examples (named time zone really work only if the time_zone tables exists on the server):
+00:00
&time_zone=%2B00%3A00
&time_zone=%27%2B00%3A00%27
UTC
&time_zone=UTC
&time_zone=%27UTC%27
Europe/Paris
&time_zone=Europe%2FParis
&time_zone=%27Europe%2FParis%27
I suppose the same issue will happen for any session parameter that is of type string.
I find that using quoting in counter-intuitive, so I'm not sure if this is that the documentation that should be fixed.
The text was updated successfully, but these errors were encountered: