Skip to content

Commit 0e8f429

Browse files
committed
Reformat Postgres version checks to reflect their structure
1 parent cece807 commit 0e8f429

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def reset_pk_sequence!(table, pk = nil, sequence = nil) # :nodoc:
288288
quoted_sequence = quote_table_name(sequence)
289289
max_pk = query_value("SELECT MAX(#{quote_column_name pk}) FROM #{quote_table_name(table)}", "SCHEMA")
290290
if max_pk.nil?
291-
if database_version >= 100000
291+
if database_version >= 10_00_00
292292
minvalue = query_value("SELECT seqmin FROM pg_sequence WHERE seqrelid = #{quote(quoted_sequence)}::regclass", "SCHEMA")
293293
else
294294
minvalue = query_value("SELECT min_value FROM #{quoted_sequence}", "SCHEMA")

activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def supports_index_sort_order?
183183
end
184184

185185
def supports_partitioned_indexes?
186-
database_version >= 110_000 # >= 11.0
186+
database_version >= 11_00_00 # >= 11.0
187187
end
188188

189189
def supports_partial_index?
@@ -239,14 +239,14 @@ def supports_insert_returning?
239239
end
240240

241241
def supports_insert_on_conflict?
242-
database_version >= 90500 # >= 9.5
242+
database_version >= 9_05_00 # >= 9.5
243243
end
244244
alias supports_insert_on_duplicate_skip? supports_insert_on_conflict?
245245
alias supports_insert_on_duplicate_update? supports_insert_on_conflict?
246246
alias supports_insert_conflict_target? supports_insert_on_conflict?
247247

248248
def supports_virtual_columns?
249-
database_version >= 120_000 # >= 12.0
249+
database_version >= 12_00_00 # >= 12.0
250250
end
251251

252252
def index_algorithms
@@ -398,7 +398,7 @@ def supports_foreign_tables?
398398
end
399399

400400
def supports_pgcrypto_uuid?
401-
database_version >= 90400 # >= 9.4
401+
database_version >= 9_04_00 # >= 9.4
402402
end
403403

404404
def supports_optimizer_hints?
@@ -531,7 +531,7 @@ def build_insert_sql(insert) # :nodoc:
531531
end
532532

533533
def check_version # :nodoc:
534-
if database_version < 90300 # < 9.3
534+
if database_version < 9_03_00 # < 9.3
535535
raise "Your version of PostgreSQL (#{database_version}) is too old. Active Record supports PostgreSQL >= 9.3."
536536
end
537537
end

0 commit comments

Comments
 (0)