# 在 postgres/mysql 中如何判断当前版本是多少

Issue

欢迎在 Issue 中交流与讨论: Issue 213 (opens new window)

使用 select version()

postgres 示例如下:

postgres@db:school> select version()
+---------------------------------------------------------------------------------------+
| version                                                                               |
|---------------------------------------------------------------------------------------|
| PostgreSQL 12.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 8.3.0) 8.3.0, 64-bit |
+---------------------------------------------------------------------------------------+
SELECT 1
Time: 0.028s

mysql 示例如下:

> select version()
+-------------+
| version()   |
|-------------|
| 5.6.16-log  |
+-------------+
1 row in set
Time: 0.003s
Last Updated: 1/17/2021, 2:02:56 PM