-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
rehashed charset implementation to support old versions of postgresql #828
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DBAL-1189 We use Jira to track the state of pull requests and the versions they got |
Looks like travis is happy, @riccardonar is happy, my tests run, all seems OK. I think we need to add a functional test for pgsql connections though - Esp. given that we have people connecting via bouncers and whatnot. |
rehashed charset option implementation to support old and new versions of postgresql, and pgbouncer
Yes, for me it works! |
@zeroedin-bill when it comes to postgres, it's extremely common to use poolers. PG has a lot more overhead when creating connections than other DBs so they're almost required for any high-volume environment. RE: travis checks I noticed you only have travis checks setup for 9.1+ anyway. The previous fix would have passed travis checks too :) RE: functional test Can you elaborate on the critiera and/or point me to some references? I wouldn't mind contributing a test. I just wrote one basically when I made these recent changes -- in that, it opens a connection used the configuration and then uses |
@rocksfrow I'm aware - I use postgres :) I'm writing a quick functional test for the charset stuff. |
* - passing client_encoding via the 'options' param breaks pgbouncer support | ||
*/ | ||
if (isset($params['charset'])) { | ||
$pdo->query('SET NAMES \''.$params['charset'].'\''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deeky666 I definitely agree this isn't the cleanest fix -- BUT, with that said, I also disagree with it going back how it was -- because you're then making the class unusable with pgbouncer (or other poolers) when it worked fine before.
I would think the only other option would be to simply rely on AUTO, and not set the client_encoding at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally get your point. It's just a question of portability vs performance. Gosh why can't PostgreSQL be consistent on this -.-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know right! So frustrating!
Well FYI -- this wasn't even being set before at all (like you said I guess it was removed). The reason this came up is because somebody added it -- so when I upgraded it totally broke on PG.
So maybe the BEST solution would be to simply totally revert these changes AND the original change:
Basically, that means DBAL doesn't set the charset at all and leaves it up to the server "auto" mode.
TBH, I was a little surprised it was being set explicity anyway as I never have in the past (instead I use AUTO (default) and it uses the systems LOCALE).
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha -- I just noticed you're actually the one who made that change @deeky666 heh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rocksfrow no offense! I just realized that this discussion is getting rather heavy for a rather trivial issue. I was just asking for additional opinions about the SET NAMES
fix. I can live with that and obviously there is no better solution yet. So let's just keep it. Thanks for all your investigation on this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@riccardonar yeah so check it out -- I have a LOWER version (8.4.20) -- and client_encoding works fine for me.
This just confirms what I was trying to tell you and @deeky666 -- this is not reliable data to make a decision off of.
@deeky666 confirmed he was just guessing anyway -- so we're leaving the current implementation (my fork). You can use my fork meanwhile until they release the next minor if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backported to 2.5 branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deeky666 the convo got crazy because people jumping in giving inaccurate data haha.
I agree this is the best solution for now -- maybe eventually we'll have something we can rely on (like PGSQL_LIBPQ_VERSION being accurate).
I think the issue is that PGSQL_LIBPQ_VERSION does not update -- even after you upgrade (I read that somewhere).
Anyway -- thank you guys for an awesome class! I am glad to contribute.
We should be good to move forward now at least.
Have a good day.
@deeky666 what we COULD do is use my previous fix for PG >= 9.1, and for backwards compatibility -- use Curious to hear your thoughts. |
@rocksfrow yep we could do that if we knew the version of the underlying server before actually connecting. This is totally driver specific, nothing that needs to be in the platform... |
NOTE: if you don't want the overhead of |
@zeroedin-bill I just saw you're from Maryland. Baltimore here! |
MD represent! haha |
@rocksfrow how bout dem O's |
@deeky666 should we backport this? |
The previous fix this is enhancing was backported so this one should be Note, this email was sent from my cell phone.
|
(The previous fix of mine that deeky already backported wasn't working w Note, this email was sent from my cell phone.
|
Just out of curiosity - what are you guys doing when you backport? When you Note, this email was sent from my cell phone.
|
@rocksfrow deeky did backport it to 2.5 - i missed that. Take a look at the 2.5 branch. |
Yeah OK -- I thought he already did. So backporting it just means it's On Fri, Apr 3, 2015 at 11:15 AM, Bill Schaller notifications@github.com
|
Is that true? IE -- I can expect to see this fix in 2.5.2 I suppose? On Fri, Apr 3, 2015 at 11:19 AM, Kyle Renfrow frow05@gmail.com wrote:
|
I just recently started using DBAL because it wasn't working with pgbouncer Thanks for any clarification you may give. I am not sure about DBAL's On Fri, Apr 3, 2015 at 11:19 AM, Kyle Renfrow frow05@gmail.com wrote:
|
@rocksfrow if you're targeting the 2.5 branch in your composer.json, you will get the update - if you're targeting a specific point version, you'll have to wait for 2.5.2 and then target that point version... |
@zeroedin-bill I am using packagist, so I suppose the "2.5.x-dev" is what you're talking about. These are production servers so I'm definitely not pointing a dev branch I am pointing to 2.5.1. I will keep an eye out for the 2.5.2 release -- and meanwhile I'll just point to my own branch. Thanks! |
@zeroedin-bill does the dbal have any standard release schedule -- or is it pretty random? Are there any processes that could lead to a predictable release date or should I not bother and just check in every now and then? |
Hey @rocksfrow, I'm also hitting this problem with pgbouncer and if you don't want to patch DBAL or use your branch - that is not always possible - there's a workaround here.
Then after connection made you may call ...in case also anyone else affected in thread here #823... |
@rixbeck that's a cool trick but I would imagine DBAL managers would agree -- we don't want to require config changes to your database stack to work with DBAL -- it should work out of the box. I am simply using the 2.5-x branch which includes my merged in fix -- I am not sure if you noticed but we ended up merging in a second/better fix which is doing exactly that -- setting the charset via SET NAMES after connection. I have been running 2.5-x branch in production within any issues -- just waiting on them to cut 2.5.2 so I can start using that (to avoid any bugs introduced) in the dev branch. |
Yeah, agree. Although it is really just a workaround until fix comes out with stable. |
My previous client_encoding fix turned out not to work on older postgres versions -- BUT, the options param isn't supported by pgbouncer at all. SO, because there isn't consistent behavior with setting the character set via DSN - this change utilizes
SET NAMES
. I used SET NAMES since that is SQL standard and supported by PG.I confirmed
SET NAMES
is supported all the way back to the older doc PG has, 7.1: http://www.postgresql.org/docs/7.1/static/multibyte.html