ActiveRecord で接続している PostgreSQL のバージョンを確認する
1132 ワード
Rails console で以下のようにすると良い。
[1] pry(main)> ActiveRecord::Base.connection.instance_eval { postgresql_version }
=> 90504
この値の解釈については pg
の gem の中身を参照。
https://github.com/ged/ruby-pg/blob/1f274f68c16f1af1c642db1b9d3d28aef169dc84/ext/pg_connection.c#L775-L785
/*
* call-seq:
* conn.server_version -> Integer
*
* The number is formed by converting the major, minor, and revision
* numbers into two-decimal-digit numbers and appending them together.
* For example, version 7.4.2 will be returned as 70402, and version
* 8.1 will be returned as 80100 (leading zeroes are not shown). Zero
* is returned if the connection is bad.
*
*/
とのことなのでこれは 9.5.4 ということになるようです。
Author And Source
この問題について(ActiveRecord で接続している PostgreSQL のバージョンを確認する), 我々は、より多くの情報をここで見つけました https://qiita.com/yuya_takeyama/items/59fd43aa915dea0e932c著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .