Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Table Dump Drops Default '' On Varchar With Not Null

forums forums SQLyog SQLyog: Bugs / Feature Requests Table Dump Drops Default '' On Varchar With Not Null

  • This topic is empty.
Viewing 0 reply threads
  • Author
    Posts
    • #11682
      normk
      Member

      SqlYog 8.14 Enterprise

      If you have a table with a varchar column set to Not Null with a Default to empty string, this is a legal definition. It allows you to perform an insert without specifying the respective column and get an empty string instead of null in the field. However, if you do an Export/Dump of the table structure, the exported definition does not include the DEFAULT ''. It has likely been optimized out by SqlYog's export optimization code.

      Here is the problem with this bug. If you backup a database and restore it in a new location and then use the Schema Synchronization power tool to compare schemas, it shows differences in all tables that had this default in the source but do not have it in the destination even though they are supposed to be identical.

      I also tested using the Schema Synchronization tool to push from the source (with the default) to an empty destination. It had the same problem as a restore from a backup file, no default in those columns. Note that if your target already contains the table and column, the sync will work correctly because it produces an Alter Table statement that adds the default. The problem only occurs when you backup and restore to an empty database or if you sync to an empty database. This is something we use all the time to provision new databases with initial values from a live master.

      This can affect business logic for any application that expects an insert to succeed without specifying the respective column that used to have the default defined.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.