KS DB Merge Tools logo KS DB Merge Tools
Documentation
KS DB Merge Tools for Cross-DBMS logo for Cross-DBMS
 
KS DB Merge Tools for Oracle logo
KS DB Merge Tools for MySQL logo
MssqlMerge logo
KS DB Merge Tools for PostgreSQL logo
KS DB Merge Tools for SQLite logo
AccdbMerge logo

Data

Data rows are identified by the values of primary key columns. Primary key columns must have the same generic non-Other data types. Column name check is case-insensitive, so for example firstName vs FirstName is considered as the same column.

Data row is considered as changed if it has changes in some non-primary-key column and that column has the same generic non-Other data type. If a non-primary-key column has a different generic data type, or one of columns has Other data type, then it is not compared at all.

These rules apply when no database is marked as Target schema. With Target schema, columns are compared by the target data types, see With Target Schema below.

If the table has no compatible primary key (same set of columns with same data types) then data rows are compared just by row number and Data diff tab has an appropriate warning: No comparison key(s). Result can be truncated. Application does not know how to identify whether the row is the same or not, changed or not. Due to the missing key columns the application can not perform paging and has to limit the number of shown rows. Row order in this case is also not guaranteed. Such a data diff result can be used just to get some kind of data changes overview, but it can't be used to identify the number of new and changed rows.

By default the Data diff tab is sorting data by primary keys. You can change sort order. You can also change to sorting column but in this case Data diff may provide unreliable results with invalid changes (both false-positive and false-negative) and shows appropriate warning: Sorting on non-key column(s). To understand why it happens, let's consider the following example: some table with ID primary key, Name column to compare and the following data:

Left table Right table
ID 🔑 ▲ Name ID 🔑 ▲ Name
1 Apple 1 Green apple
2 Banana 2 Banana

Such a table has row counts Total = 2, New = 0 and Changed = 1 for both sides.

Now if we perform sorting by name then in the right table row with ID=1 will have to be shown last because 'Green apple' > 'Banana':

Left table Right table
ID 🔑 Name ▲ ID 🔑 Name ▲
1 Apple
2 Banana 2 Banana
1 Green apple

Such a table has row counts Total = 2, New = 1 and Changed = 0 for both sides which is obviously wrong. And visually it may cause an impression that we have more rows than expected.

With Target Schema

In the Open databases dialog one of the databases can be marked as Target schema. It is required for the schema merge, and it also changes how data is compared: the data of the other (source) database is compared as it would be stored in the target database.

  • The data type of each source column is converted to the target DBMS, to the same type that the schema merge creates. The Table structure diff tab shows it in the Type ({target DBMS}) column.
  • A source column is compared with the target column if its converted data type is compatible with the target column type, and the application can convert its values. Compatible means the same generic data type (not Other), or the same data type name: for example a PostgreSQL uuid column converted to SQL Server uniqueidentifier is compared with a uniqueidentifier column. PostgreSQL json and jsonb are compatible with each other. Primary key columns follow the same rule. Table structure diff shows the result in the Type status column.
  • The source values are converted to the target column type, and Data diff shows the converted values. For example, a number is rounded to the scale of the target DECIMAL column, a date/time value is rounded to the fractional seconds of the target column, a GUID into a text column becomes lowercase text, a boolean into a number column becomes 1 or 0, and an empty string becomes NULL for an Oracle target. So a row is shown as changed only if the merge would change the target value.
  • A value that can't be converted (for example, a value out of the range of the target type) is kept as is. Its row is shown as changed, and the merge of this row fails on the target database server.
  • A target column can be narrower than the source column, for example DECIMAL(10,2) into an INT column, or a long text into VARCHAR(50). Such values are rounded or rejected by the target database, and the merge dialog shows a warning.
  • Data can be merged and deleted only in the database marked as Target schema. Merge and delete in the other database are not available, because Data diff shows converted values for its rows.

Date/time values with a time zone offset

Only SQL Server DATETIMEOFFSET and Oracle TIMESTAMP WITH TIME ZONE columns store an offset. If both columns store it, two values are equal only if they are the same moment with the same offset. In all other cases the application compares the UTC moments, and a value without an offset counts as UTC. Primary key values are always matched by the UTC moment.

JSON and XML

If the target column is a JSON or XML data type (PostgreSQL json, jsonb and xml, MySQL JSON, SQL Server json and xml, Oracle JSON and XMLTYPE), the values are compared without formatting differences. The grid and the merge use the original texts, only the comparison ignores formatting. Text that is not valid JSON or XML is compared as text. A text target column (like TEXT, CLOB or NVARCHAR(MAX)) keeps the exact text, so its values are compared as text.

  • JSON: whitespace outside of strings and string escapes don't matter. Number text is compared as is, so 1.50 is not equal to 1.5.
  • JSON key order: PostgreSQL jsonb and MySQL JSON store object keys sorted (by key length in bytes, then by bytes). Other JSON types keep the key order of the text. If only one side stores keys sorted, the keys of the other side are compared in the sorted order, and Data diff shows a warning above the grid of that side: JSON keys are compared in the key order of the other side (it stores them sorted).
  • JSON duplicate keys: only PostgreSQL json keeps them. PostgreSQL jsonb and MySQL JSON keep the last value, SQL Server json keeps the first value, and Oracle JSON rejects such a value. So a value with a duplicate key stays changed after the merge (the target keeps only one of the values), and the merge of such a row into Oracle fails.
  • XML: the XML declaration, whitespace between elements, quotes and the form of an empty element (<a></a> and <a/>) don't matter. Namespaces, CDATA, comments and processing instructions are compared. Note that SQL Server xml does not keep CDATA, so such a value stays changed after the merge.

Time Zones

The application uses the UTC time zone for its MySQL, PostgreSQL and Oracle database sessions, with or without Target schema. So the values of the data types that the database shows in the session time zone are shown and compared in UTC: PostgreSQL timestamptz, MySQL TIMESTAMP and Oracle TIMESTAMP WITH LOCAL TIME ZONE. Data diff shows a warning above the grid of a table with such a column, for example TIMESTAMPTZ values are shown and compared in UTC, not in the local time zone. A merge script value without an offset also means UTC, so a merged value is the same moment as the source value.

These values can be different from what other tools show in your local time zone. Session time functions in Query result diff queries, like now() or CURRENT_DATE, also return UTC values.


Last updated: 2026-11-18