Get the postgres version

You can do select version(); which returns something like:

+---------------------------------------------------------------------------------------------------------------------------------+
| version                                                                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------|
| PostgreSQL 17.2 (Postgres.app) on aarch64-apple-darwin23.6.0, compiled by Apple clang version 15.0.0 (clang-1500.3.9.4), 64-bit |
+---------------------------------------------------------------------------------------------------------------------------------+

or show server_version, which returns a shorter output:

+---------------------+
| server_version      |
|---------------------|
| 17.2 (Postgres.app) |
+---------------------+