New Page Insert Fails cannot insert null

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
1/5/2014 8:49:24 PM
Gravatar
Total Posts 55

New Page Insert Fails cannot insert null

 I installed mojo 2.4.0.0 on my arvixe hosting space.

They are running sql server 2012 R2 not sure of service pack or windows server version, and .Net version is 4.0

The Site is currently closed as we are developing the content, however after about the 5th page I was adding the following error occurred.

 

2014-01-05 18:14:30,912 ERROR (null) - (null) - (null) - mojoPortal.Web.Global -  Referrer(http://mydomain/Admin/PageSettings.aspx?start=1) useragent Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)
System.Data.SqlClient.SqlException (0x80131904): Cannot insert the value NULL into column 'ShowPageHeading', table 'mojoportalqfl.dbo.mp_Pages'; column does not allow nulls. INSERT fails.
The statement has been terminated.

 

I have cleared all cache, restarted the site and I still cannot add a new page. I looked through the url manager and nothing looks out of the ordinary. I believe the error happened when I tried to change the value of the page name or the Page Override Title using the admin panel. Either way any assistance is much appreciated

1/6/2014 6:44:48 AM
Gravatar
Total Posts 18444

Re: New Page Insert Fails cannot insert null

"I installed mojo 2.4.0.0 on my arvixe hosting space."

No you did not, version 2.4.0.0 did not have the column "ShowPageHeading", that column was added in script 2.4.0.1 which is only available in our source code repository not in an official release. Also as defined in the 2.4.0.1 script it has a default value of 0 so it will never be null or cause this error.

So I do not understand how you arrived at this error unless you made your own build from source code and somehow left out the default value for the column by modifying the script. Or else you migrated the table from another database and it lost its default value during the migration.

 

1/6/2014 7:33:22 AM
Gravatar
Total Posts 55

Re: New Page Insert Fails cannot insert null

Joe, it was the later. I restored the database from a previous version. Its back to running. I will study the upgrade progess better. have a beer on me
1/6/2014 10:50:28 AM
Gravatar
Total Posts 18444

Re: New Page Insert Fails cannot insert null

Hi,

Thanks for the beer! It is very appreciated.

When moving or copying a database always use the backup and restore functionality of the db platform. Importing tables will cause problems because the tables lose their primary key, default values, auto-increment ids, constraints and indexes. By using backup and restore the tables will retain those things but importing tables will lose them.

Best,

Joe

1/7/2014 4:05:56 PM
Gravatar
Total Posts 55

Re: New Page Insert Fails cannot insert null

Joe,

I am currently running sql server 2008 R2 locally and the Arvixe space is running 2012 R2.

Can I restore the local 2008 R2 backup in the 2012 space without issue or would you recommend upgrading the local to 2012 R2 to match.

 

 

Thanks,

Joe

1/8/2014 11:54:58 AM
Gravatar
Total Posts 18444

Re: New Page Insert Fails cannot insert null

generally newer versions of sql server can restore backups made in older versions. However it is not always possible to restore a backup created on a newer version to an older version of sql server. 

that is, a backup made in sql server 2008 you should be able to restore on sql 2012 with no problem

but a backup made on sql server 2012 I'm not sure if you could restore it on a sql 2008 server. 

You could create a backup from your host and try to restore it on the local machine to find out if it is possible. If it is possible then there is no big reason to upgrade your local machine. But if restoring the backup fails on the local machine then it might be good to upgrade if you want to be able to run an up to date testing copy of your site on your local machine

Hope that helps,

Joe

5/8/2014 2:58:55 AM
Gravatar
Total Posts 27

Re: New Page Insert Fails cannot insert null

I am having the same problem on a Windows Azure installation. Everything but page creation works fine. Do you think that I can  modify (repair) the dbo.mp_pages table directly? A lot of work has been added to the site and if I restore an older version I will loose it.

Thanks for any suggestion

 

 

5/8/2014 10:43:37 AM
Gravatar
Total Posts 18444

Re: New Page Insert Fails cannot insert null

depends on the reason for the error.

either you are missing a default value on a column which should have been added by one of the installation/upgrade scripts, which you could add to fix the problem if you know what column and what the default should be.

or that error could result from a mismatch of files uploaded such the the code and the database schema are not in sync

You must sign in to post in the forums. This thread is closed to new posts.