提交 b970d205 编写于 作者: J Jeremy Kemper

r3027@asus: jeremy | 2005-11-12 22:37:45 -0800

 Apply [2994] to stable.  PostgreSQL: correct the sequence discovery fallback query.  References #2594.


git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@2995 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 9403f471
......@@ -201,7 +201,7 @@ def schema_search_path #:nodoc:
def default_sequence_name(table_name, pk = nil)
default_pk, default_seq = pk_and_sequence_for(table_name)
default_seq || "#{table_name}_#{pk || default_pk}_seq"
default_seq || "#{table_name}_#{pk || default_pk || 'id'}_seq"
end
# Resets sequence to the max value of the table's pk if present.
......@@ -258,7 +258,7 @@ def pk_and_sequence_for(table)
JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1])
WHERE t.oid = '#{table}'::regclass
AND cons.contype = 'p'
AND def.adsrc ~ 'nextval\\\\(\\\'[^\\\']*\\\'::[^\\\\)]*\\\\)'
AND def.adsrc ~* 'nextval'
end_sql
end
result
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册