diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-13 06:32:54 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-13 06:32:54 +0000 |
commit | 077ae340e8c3013dd43ebcc8023d183dfdd52d4a (patch) | |
tree | 093bb96b8cca549ddd2b320d1c692c80998fb8d9 /activerecord/lib | |
parent | d685e2cf18e885a74c601f1a05f59af39e00564d (diff) | |
download | rails-077ae340e8c3013dd43ebcc8023d183dfdd52d4a.tar.gz rails-077ae340e8c3013dd43ebcc8023d183dfdd52d4a.tar.bz2 rails-077ae340e8c3013dd43ebcc8023d183dfdd52d4a.zip |
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
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index dc5dc4032e..82295f1f49 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -201,7 +201,7 @@ module ActiveRecord 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 @@ module ActiveRecord 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 |