提交 64e494f7 编写于 作者: R Ryuta Kamizono

Use `max_identifier_length` for `index_name_length` in PostgreSQL adapter

Actually `index_name_length` depend on `max_identifier_length`, not
always 63.
上级 7888f4fa
* Use `max_identifier_length` for `index_name_length` in PostgreSQL adapter.
*Ryuta Kamizono*
* Deprecate `supports_migrations?` on connection adapters.
*Ryuta Kamizono*
......
......@@ -615,10 +615,6 @@ def extract_foreign_key_action(specifier) # :nodoc:
end
end
def index_name_length
63
end
# Maps logical Rails types to PostgreSQL-specific data types.
def type_to_sql(type, limit: nil, precision: nil, scale: nil, array: nil, **) # :nodoc:
sql = \
......
......@@ -215,7 +215,7 @@ def initialize(connection, logger, connection_parameters, config)
# @local_tz is initialized as nil to avoid warnings when connect tries to use it
@local_tz = nil
@table_alias_length = nil
@max_identifier_length = nil
connect
add_pg_encoders
......@@ -358,8 +358,9 @@ def extensions
# Returns the configured supported identifier length supported by PostgreSQL
def table_alias_length
@table_alias_length ||= query("SHOW max_identifier_length", "SCHEMA")[0][0].to_i
@max_identifier_length ||= select_value("SHOW max_identifier_length", "SCHEMA").to_i
end
alias index_name_length table_alias_length
# Set the authorized user for this session
def session_auth=(user)
......
......@@ -105,7 +105,7 @@ def test_table_exists_logs_name
end
def test_table_alias_length_logs_name
@connection.instance_variable_set("@table_alias_length", nil)
@connection.instance_variable_set("@max_identifier_length", nil)
@connection.table_alias_length
assert_equal "SCHEMA", @subscriber.logged[0][1]
end
......@@ -177,7 +177,6 @@ def test_reconnection_after_actual_disconnection_with_verify
assert_not_equal original_connection_pid, new_connection_pid,
"umm -- looks like you didn't break the connection, because we're still " \
"successfully querying with the same connection pid."
ensure
# Repair all fixture connections so other tests won't break.
@fixture_connections.each(&:verify!)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册