Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

r4331@asus: jeremy | 2005-11-12 17:03:45 -0800

 PostgreSQL: default_sequence_name falls back to 'id' pk if both the given pk and discovered pk are nil.
 r4336@asus:  jeremy | 2005-11-12 22:31:39 -0800
 PostgreSQL: correct the sequence discovery fallback query.  References #2594.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2994 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 077ae340e8c3013dd43ebcc8023d183dfdd52d4a 1 parent d685e2c
@jeremy jeremy authored
View
4 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.