Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Query for sequence info also should be markd as SCHEMA.

  • Loading branch information...
commit 3dc402112e6f689675e4868866bffc69966e8a0f 1 parent 8933efb
Toshinori Kajihara authored September 15, 2012
6  activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
@@ -252,7 +252,7 @@ def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:
252 252
           if pk && sequence
253 253
             quoted_sequence = quote_table_name(sequence)
254 254
 
255  
-            select_value <<-end_sql, 'Reset sequence'
  255
+            select_value <<-end_sql, 'SCHEMA'
256 256
               SELECT setval('#{quoted_sequence}', (SELECT COALESCE(MAX(#{quote_column_name pk})+(SELECT increment_by FROM #{quoted_sequence}), (SELECT min_value FROM #{quoted_sequence})) FROM #{quote_table_name(table)}), false)
257 257
             end_sql
258 258
           end
@@ -262,7 +262,7 @@ def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:
262 262
         def pk_and_sequence_for(table) #:nodoc:
263 263
           # First try looking for a sequence with a dependency on the
264 264
           # given table's primary key.
265  
-          result = query(<<-end_sql, 'PK and serial sequence')[0]
  265
+          result = query(<<-end_sql, 'SCHEMA')[0]
266 266
             SELECT attr.attname, seq.relname
267 267
             FROM pg_class      seq,
268 268
                  pg_attribute  attr,
@@ -283,7 +283,7 @@ def pk_and_sequence_for(table) #:nodoc:
283 283
             # If that fails, try parsing the primary key's default value.
284 284
             # Support the 7.x and 8.0 nextval('foo'::text) as well as
285 285
             # the 8.1+ nextval('foo'::regclass).
286  
-            result = query(<<-end_sql, 'PK and custom sequence')[0]
  286
+            result = query(<<-end_sql, 'SCHEMA')[0]
287 287
               SELECT attr.attname,
288 288
                 CASE
289 289
                   WHEN split_part(def.adsrc, '''', 2) ~ '.' THEN

0 notes on commit 3dc4021

Please sign in to comment.
Something went wrong with that request. Please try again.