reflected table and defaults for string fields

Issue #1655 resolved
Former user created an issue

i have a schema like this

CREATE TABLE users_test ( id int(11) NOT NULL AUTO_INCREMENT, username varchar(30) COLLATE utf8_unicode_ci NOT NULL, password varchar(32) COLLATE utf8_unicode_ci NOT NULL, temporary_password varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ffff', session_id varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'a', points decimal(12,6) NOT NULL DEFAULT '0.000000', cash decimal(12,6) NOT NULL DEFAULT '0.000000', merits decimal(12,6) NOT NULL DEFAULT '0.000000', honour_level int(11) NOT NULL DEFAULT '0', country char(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'a', usergroup varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'a', status int(3) NOT NULL DEFAULT '0', risk_score decimal(5,2) NOT NULL DEFAULT '0.00', proxy_score decimal(5,2) DEFAULT '0.00', score decimal(5,2) DEFAULT '0.00', browser varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'a', browser_language varchar(75) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'a', ip varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'a', ip_org varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'a', ip_isp varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'a', last_active datetime NOT NULL DEFAULT '2000-01-01 00:00:00', date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, referrer int(11) NOT NULL DEFAULT '0', site_id tinyint(4) NOT NULL DEFAULT '0', test_group tinyint(4) NOT NULL DEFAULT '0', last_profile_id int(11) NOT NULL DEFAULT '0', PRIMARY KEY (id), UNIQUE KEY username (username), KEY status (status), KEY session_id (session_id), KEY last_active (last_active), KEY ip (ip), KEY date_status_usergroup_referrer (date,status,usergroup,referrer), KEY referer_date (referrer,date), KEY browser (browser), KEY country (country), KEY browser_language (browser_language) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

for all string type fields metadata doesnt contain server_default values, thus when i insert a new row sa adds colnames like session_id and tries to insert None to those.

Also all fields like ints, floats or decimals DO get the server_default values and are omitted when i insert new row.

Comments (3)

  1. Log in to comment