This project is archived and is in readonly mode.
[Patch] Postgres support for standard_conforming_strings = on
-
Joe Rafaniello
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.
-
Joe Rafaniello
Can this patch be moved upstream?
-
Marcin Mańk
- 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
-
Marcin Mańk
updated patch attached
-
...Paul
- 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 PostgresSQLAdapter#unescape_bytea does not handle "\\", 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
- 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
- Tag changed from 2, 2.3.5, edge, postgres to 2-3-stable, 2.3.5, edge, postgres
- Importance changed from to
-
Julian Mehnle
- Tag set to 2-32-3-stable, 2.3.5, edge, postgres
-
Julian Mehnle
- Tag changed from 2-32-3-stable, 2.3.5, edge, postgres to 2-3-stable, 2.3.5, edge, postgres
