PostgreSQL: correctly quote the ' in pk_and_sequence_for. Closes #5462.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4580 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper
2006-07-07 21:19:27 +00:00
parent c4233a0eae
commit 3080b273a8
2 changed files with 3 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
*SVN*
* PostgreSQL: correctly quote the ' in pk_and_sequence_for. #5462 [tietew@tietew.net]
* PostgreSQL: correctly quote microseconds in timestamps. #5641 [rick@rickbradley.com]
* Clearer has_one/belongs_to model names (account has_one :user). #5632 [matt@mattmargolis.net]

View File

@@ -303,7 +303,7 @@ module ActiveRecord
# the 8.1+ nextval('foo'::regclass).
# TODO: assumes sequence is in same schema as table.
result = query(<<-end_sql, 'PK and custom sequence')[0]
SELECT attr.attname, name.nspname, split_part(def.adsrc, '\\\'', 2)
SELECT attr.attname, name.nspname, split_part(def.adsrc, '''', 2)
FROM pg_class t
JOIN pg_namespace name ON (t.relnamespace = name.oid)
JOIN pg_attribute attr ON (t.oid = attrelid)