@@ -336,13 +336,71 @@ Doctrine ships with different database platform implementations for some vendors
336336to support version specific features, dialect and behaviour.
337337
338338The drivers will automatically detect the platform version and instantiate
339- the corresponding platform class.
339+ the corresponding platform class. However, this mechanism might cause the
340+ connection to be established prematurely.
340341
341342You can also pass the ``serverVersion `` option if you want to disable automatic
342343database platform detection and choose the platform version implementation explicitly.
343344
344- If you are running a MariaDB database, you should prefix the ``serverVersion ``
345- with ``mariadb- `` (ex: ``mariadb-10.2.12 ``).
345+ Please specify the full server version as the database server would report it.
346+ This is especially important for MySQL and MariaDB where the full version
347+ string is taken into account when determining the platform.
348+
349+ MySQL
350+ ^^^^^
351+
352+ Connect to your MySQL server and run the ``SELECT VERSION() `` query::
353+
354+ mysql> SELECT VERSION();
355+ +-----------+
356+ | VERSION() |
357+ +-----------+
358+ | 8.0.32 |
359+ +-----------+
360+ 1 row in set (0.00 sec)
361+
362+ In the example above, ``8.0.32 `` is the correct value for ``serverVersion ``.
363+
364+ MariaDB
365+ ^^^^^^^
366+
367+ Connect to your MariaDB server and run the ``SELECT VERSION() `` query::
368+
369+ MariaDB [(none)]> SELECT VERSION();
370+ +-----------------------------------------+
371+ | VERSION() |
372+ +-----------------------------------------+
373+ | 10.11.2-MariaDB-1:10.11.2+maria~ubu2204 |
374+ +-----------------------------------------+
375+ 1 row in set (0.001 sec)
376+
377+ In the example above, ``10.11.2-MariaDB-1:10.11.2+maria~ubu2204 `` is the
378+ correct value for ``serverVersion ``.
379+
380+ Postgres
381+ ^^^^^^^^
382+
383+ Connect to your Postgres server and run the ``SHOW server_version `` query::
384+
385+ postgres=# SHOW server_version;
386+ server_version
387+ --------------------------------
388+ 15.2 (Debian 15.2-1.pgdg110+1)
389+ (1 row)
390+
391+ In the example above, ``15.2 (Debian 15.2-1.pgdg110+1) `` is the correct value for
392+ ``server Version ``.
393+
394+ Other Platforms
395+ ^^^^^^^^^^^^^^^
396+
397+ For other platforms, DBAL currently does not implement version-specific
398+ platform detection, so specifying the ``serverVersion `` parameter has no effect.
399+
400+ However, you can still do so. You can use the string that the following
401+ expression returns::
402+
403+ $connection->getWrappedConnection()->getServerVersion();
346404
347405Custom Driver Options
348406~~~~~~~~~~~~~~~~~~~~~
0 commit comments