This project is archived and is in readonly mode.
[Patch] Postgres support for standard_conforming_strings = on
Reported by Joe Rafaniello | April 3rd, 2009 @ 09:13 PM | in 2.3.6
Many ActiveRecord PG unit tests failed on PG 8.3.6 if standard_conforming_strings was set to "on"
E should only be prefixed for standard_conforming_strings = off E was also being prefixed for standard_conforming_strings = on due to a bug.
Attached patch fixes the existing logic.
I'll attach the original AR tests logs indicating the error.
Comments and changes to this ticket
-
Joe Rafaniello April 3rd, 2009 @ 09:18 PM
The patch addresses the following errors in the attached AR unit test log:
1) Failure: test_quote(BasicsTest)
[./test/cases/base_test.rb:1478:in `test_quote' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in `__send__' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in `run']:
<"\ \001 ' \n \n ""> expected but was <" \001 ' \n \n "">.
2) Error: test_load_save(BinaryTest): ActiveRecord::StatementInvalid: PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xff
There are several of the invalid byte sequence errors and a few quoting issues also in the log.
-
Marcin Mańk February 4th, 2010 @ 11:02 PM
- Tag changed from 2.3.x, edge, postgres to 2, edge, postgres
The regex should be /(1|t|true|on)/i , not /[1|t|true|on]/i
-
...Paul March 10th, 2010 @ 12:29 AM
- Tag changed from 2, edge, postgres to 2, 2.3.5, edge, postgres
Ah, this bug was already filed, great. I sparked some commentary on the wrong, bug, issue #1837, that may have some bearing. It looks like the patch is already done, but one thing to keep in mind is that the patch is making an assumption that the underlying library is doing the right thing by not escaping backslashes when scs is "on". While this is probably the safe bet, since I believe the postgres 0.79 gem, and definitely the pg gem (v0.8 and 0.9) both do "the right thing", if there are any legacy libs out there (not sure if the ruby-postgres gem is still in use, or if it does the "right thing", for example), that would escape backslashes even when scs is "on", then the E prefix needs to be used. To be absolutely complete, the code should be checking if the result of a call to quote() returns an escaped backslash -- if it does, then the E prefix needs to be used, regardless of whether or not the server is reporting scs "on".
It would really be good, for sure, to get this into 2.3.6 if possible.
-
Jeremy Kemper March 10th, 2010 @ 04:46 PM
- Milestone changed from 2.x to 2.3.6
- State changed from new to duplicate
Pending a tested patch that feature-checks the driver.
-
Andrea Campi October 16th, 2010 @ 11:43 PM
- Tag changed from 2, 2.3.5, edge, postgres to 2-3-stable, 2.3.5, edge, postgres
- Importance changed from to
-
Julian Mehnle March 15th, 2011 @ 01:31 AM
- Tag cleared.
So, Jeremy, which bug is this one a duplicate of?
-
Julian Mehnle March 15th, 2011 @ 01:32 AM
- Tag set to 2-32-3-stable, 2.3.5, edge, postgres
-
Julian Mehnle March 15th, 2011 @ 01:33 AM
- Tag changed from 2-32-3-stable, 2.3.5, edge, postgres to 2-3-stable, 2.3.5, edge, postgres
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>