?
avatar waader
waader
19 Dec 2016

Steps to reproduce the issue

Apply #13288. Add a new contact and assign a linked user. You will get this error:

Save failed with the following error: [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot insert the value NULL into column 'checked_out', table 'joomla35.dbo.#__contact_details'; column does not allow nulls. INSERT fails. SQL=INSERT INTO [#__contact_details] ([name],[alias],[con_position],[address],[suburb],[state],[country],[postcode],[telephone],[fax],[misc],[image],[email_to],[default_con],[published],[ordering],[params],[user_id],[catid],[access],[mobile],[webpage],[sortname1],[sortname2],[sortname3],[language],[created],[created_by],[created_by_alias],[modified],[metakey],[metadesc],[metadata],[featured],[xreference],[publish_up],[publish_down],[version]) VALUES ('test','test','','','','','','','','','','','','0','1','1','{"show_contact_category":"","show_contact_list":"","presentation_style":"","show_tags":"","show_info":"","show_name":"","show_position":"","show_email":"","show_street_address":"","show_suburb":"","show_state":"","show_postcode":"","show_country":"","show_telephone":"","show_mobile":"","show_fax":"","show_webpage":"","show_image":"","show_misc":"","allow_vcard":"","show_articles":"","articles_display_num":"","show_profile":"","show_links":"","linka_name":"","linka":false,"linkb_name":"","linkb":false,"linkc_name":"","linkc":false,"linkd_name":"","linkd":false,"linke_name":"","linke":false,"contact_layout":"","show_email_form":"","show_email_copy":"","banned_email":"","banned_subject":"","banned_text":"","validate_session":"","custom_reply":"","redirect":""}','300','4','1','','','','','','*','2016-12-19 20:07:20','299','','2016-12-19 20:07:20','','','{"robots":"","rights":""}','0','','1900-01-01 00:00:00','1900-01-01 00:00:00','1')

Expected result

Actual result

System information (as much as possible)

Additional comments

avatar waader waader - open - 19 Dec 2016
avatar joomla-cms-bot joomla-cms-bot - change - 19 Dec 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 19 Dec 2016
avatar pocketpc
pocketpc - comment - 20 Dec 2016

I get "Cannot insert the value NULL into column 'checked_out'" errors from a lot of different things. The root cause seems to be that Joomla doesn't set default values properly for certain data types (particularly datetimes) on mssql, but I don't know how Joomla handles corrections to DB config after installation.

avatar andrepereiradasilva
andrepereiradasilva - comment - 20 Dec 2016

the problem seem s to be here
https://github.com/joomla/joomla-cms/blob/staging/installation/sql/sqlazure/joomla.sql#L423

When you have a NOT NULL db field you should have a default value.

Like it happen in mysql.
https://github.com/joomla/joomla-cms/blob/staging/installation/sql/mysql/joomla.sql#L272
and postgresql
https://github.com/joomla/joomla-cms/blob/staging/installation/sql/postgresql/joomla.sql#L264

There are several cases like that in mssql install file.

avatar andrepereiradasilva
andrepereiradasilva - comment - 20 Dec 2016
avatar pocketpc
pocketpc - comment - 20 Dec 2016

Works fine on my DB with manually added default values. I'll do some testing on a fresh DB, but it looks like we need to put together an update script to add all the missing default values ("checked_out" columns seem to be the most common offender).

avatar andrepereiradasilva
andrepereiradasilva - comment - 20 Dec 2016

yes, but a full revision should be done. Changes would need to be done to sqlazure installation.sql and then alter coluns in a 3.7.0-2016-12-xx.sql update file.

avatar tonypartridge
tonypartridge - comment - 21 Dec 2016

Also its not always required to add a default value is it is set to not null. It depends on the type in use as so wether it requires a default to be set manually.

avatar csthomas
csthomas - comment - 20 Feb 2017

This issue is fixed. Please close it.

avatar zero-24 zero-24 - change - 20 Feb 2017
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-02-20 22:03:09
Closed_By zero-24
avatar zero-24 zero-24 - close - 20 Feb 2017
avatar zero-24
zero-24 - comment - 20 Feb 2017

Thanks @csthomas

Add a Comment

Login with GitHub to post a comment