If you’re using DuckDB and you need to check which version you’re running, here are some quick and easy methods to do so.
Option 1: Connect to DuckDB
When you first connect to DuckDB using a command line interface (such as Terminal on the Mac), the first thing you should see is the version number.
duckdb
Result on my system:
v1.1.3 19864453f7
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
We can see the version number on the first line, along with the source ID. In this case it’s v1.1.3 19864453f7.
Option 2: Check Without Connecting
You can also use the following command if you just want to check the version without actually connecting to DuckDB:
duckdb --version
Output:
v1.1.3 19864453f7
This is simply returned in the command line interface without launching DuckDB.
Option 3: The version()
Function
If you’re already connected to DuckDB, you can find out which version it is with the version()
function:
SELECT version();
Result on my system:
+-------------+
| "version"() |
+-------------+
| v1.1.3 |
+-------------+
Option 4: The PRAGMA version
Command
You can also use PRAGMA version
:
PRAGMA version;
Result:
+-----------------+------------+
| library_version | source_id |
+-----------------+------------+
| v1.1.3 | 19864453f7 |
+-----------------+------------+
We can see that this command also returns a source_id
column.
We can also do the following:
CALL pragma_version();
Output:
+-----------------+------------+
| library_version | source_id |
+-----------------+------------+
| v1.1.3 | 19864453f7 |
+-----------------+------------+
And we can also use a SELECT
statement:
SELECT * FROM pragma_version();
Output:
+-----------------+------------+
| library_version | source_id |
+-----------------+------------+
| v1.1.3 | 19864453f7 |
+-----------------+------------+
Actually, DuckDB allows us to replace SELECT * FROM
with just FROM
. So we can shorten it to this:
FROM pragma_version();
Output:
+-----------------+------------+
| library_version | source_id |
+-----------------+------------+
| v1.1.3 | 19864453f7 |
+-----------------+------------+
Bonus: The PRAGMA platform
Command
Another thing we can do is use PRAGMA platform
to get the platform. Although this isn’t the version number, we may occasionally need to check it.
Example:
PRAGMA platform;
Result:
+-----------+
| platform |
+-----------+
| osx_arm64 |
+-----------+
The platform information consists of the operating system, system architecture, and, optionally, the compiler.
The above can also be achieved with this:
CALL pragma_platform();
Result:
+-----------+
| platform |
+-----------+
| osx_arm64 |
+-----------+
And this:
SELECT * FROM pragma_platform();
Result:
+-----------+
| platform |
+-----------+
| osx_arm64 |
+-----------+
And this:
FROM pragma_platform();
Result:
+-----------+
| platform |
+-----------+
| osx_arm64 |
+-----------+