]> git.joonet.de Git - adminer.git/commitdiff
MS SQL: Fix collation issues when retrieving default values
authorJakub Vrana <jakub@vrana.cz>
Wed, 19 Mar 2025 06:05:31 +0000 (07:05 +0100)
committerJakub Vrana <jakub@vrana.cz>
Wed, 19 Mar 2025 16:29:42 +0000 (17:29 +0100)
I was getting this error:
Error in query (4189): Cannot convert to text/ntext or collate to 'Czech_100_CI_AI_SC_UTF8' because these legacy LOB types do not support UTF-8 or UTF-16 encodings. Use types varchar(max), nvarchar(max) or a collation which does not have the _SC or _UTF8 flags.

This reverts part of a2adb67.

CHANGELOG.md
adminer/drivers/mssql.inc.php

index b386eca3f96136176c54b2eea0835e4a2bd5c7dd..707d1379e4b907f0b27369f20622a5d2eeadca6d 100644 (file)
@@ -2,6 +2,7 @@
 - PostgreSQL: Display auto_increment of inserted rows
 - PostgreSQL: Display description of system variables
 - PostgreSQL: Avoid warning about crdb_version (bug #924, regression from 5.0.5)
+- MS SQL: Fix collation issues when retrieving default values
 - CSS: Sticky table headers (bug #918)
 - CSS: Allow more custom styles with dark mode (bug #925)
 - IMAP: New plugin driver created for fun
index d21451ec2787065e7470221cc000f21cc888d96a..9e49a3a28c520b853f23df87a795ee640325a0f7 100644 (file)
@@ -355,7 +355,7 @@ WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V')
                $return = array();
                $table_id = get_val("SELECT object_id FROM sys.all_objects WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V') AND name = " . q($table));
                foreach (
-                       get_rows("SELECT c.max_length, c.precision, c.scale, c.name, c.is_nullable, c.is_identity, c.collation_name, t.name type, CAST(d.definition as text) [default], d.name default_constraint, i.is_primary_key
+                       get_rows("SELECT c.max_length, c.precision, c.scale, c.name, c.is_nullable, c.is_identity, c.collation_name, t.name type, d.definition [default], d.name default_constraint, i.is_primary_key
 FROM sys.all_columns c
 JOIN sys.types t ON c.user_type_id = t.user_type_id
 LEFT JOIN sys.default_constraints d ON c.default_object_id = d.object_id