Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

At 1.2.1 upgrade get this error - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘cataloginventory_stock_status’ already exists
 
tempus fugit
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2008-03-09
UK
 

Error in file"/home/useip/public_html/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php" SQLSTATE[42S01]Base table or view already exists1050 Table 'cataloginventory_stock_status' already exists

From other threads found it was necessary to edit file:
/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php

Look for the line of code that says:

CREATE TABLE `{$installer->getTable('cataloginventory_stock_status')}` (

and insert this new line before it:

DROP TABLE IF EXISTS {$this->getTable('cataloginventory_stock_status')};

Check that single quote marks copy & paste correctly as my first attempt failed due to these.

Then, back to your browser and re-visit your magento base url - hopefully you’ll have solved this error (and probably have a fresh one).

All kudos to spuky and Sindre/Proper Host for the fix; I just tried to make it a little bit more idiot-proof having just gotten through it! grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
Defcon2
Member
 
Avatar
Total Posts:  36
Joined:  2008-08-01
Rosario, Santa Fe, Argentina
 

Thanks for this topic!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
LorenzoG
Member
 
Total Posts:  36
Joined:  2007-09-02
 

Thank you guys! I had of course exactly the same problem smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
rupen
Jr. Member
 
Total Posts:  14
Joined:  2009-01-27
 

Thank you! Worked as a charm for me too grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
zkorosi
Member
 
Avatar
Total Posts:  33
Joined:  2008-04-12
Hungary / Magyarország
 

Thank you! This is the solution…

You can run this sql command after upgrade in phpMyAdmin:

DROP TABLE `cataloginventory_stock_status`;
CREATE TABLE `cataloginventory_stock_status` (
  `
product_idint(10unsigned NOT NULL,
  `
website_idsmallint(5unsigned NOT NULL,
  `
stock_idsmallint(4unsigned NOT NULL,
  `
qtydecimal(12,4NOT NULL DEFAULT '0.0000',
  `
stock_statustinyint(3unsigned NOT NULL,
  
PRIMARY KEY (`product_id`,`website_id`,`stock_id`),
  
CONSTRAINT `FK_CATALOGINVENTORY_STOCK_STATUS_STOCKFOREIGN KEY (`stock_id`) REFERENCES `cataloginventory_stock` (`stock_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  
CONSTRAINT `FK_CATALOGINVENTORY_STOCK_STATUS_PRODUCTFOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  
CONSTRAINT `FK_CATALOGINVENTORY_STOCK_STATUS_WEBSITEFOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE
ENGINE=InnoDB DEFAULT CHARSET=utf8

Thats all… grin

Zozo

 
Magento Community Magento Community
Magento Community
Magento Community
 
DDMAN
Sr. Member
 
Total Posts:  179
Joined:  2008-01-08
 

I tried the first solution posted by tempus fugit and at first it didn’t work.

Then I repasted the code and made sure that I cleared by the var/cache and var/session folders and it worked fine.

Thanks

Also note that I wasn’t sure exactly where to put the code so for anyone else a little unsure where it goes I put it after $installer->run(” and before CREATE TABLE on its own line.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yumi
Jr. Member
 
Total Posts:  7
Joined:  2009-02-20
 

Just installed 1.2.1 with demodata (which is an older file). The script above resulted in an error saying a table to be dropped could not be found. Just left out the first line “drop ............” and it set up the new table. After this it works.

Michael

 
Magento Community Magento Community
Magento Community
Magento Community
 
philwinkle
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2009-02-04
West Palm Beach, FL
 

Worked perfectly - thanks!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Opalice
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-12-10
Brussels, Belgium
 

Hi all, i have a error when i want to execute mysql syntax
--

localhost printibe_magento
Erreur
requête SQL:

CREATE TABLE `cataloginventory_stock_status` (
`product_id` INT( 10 ) UNSIGNED NOT NULL ,
`website_id` SMALLINT( 5 ) UNSIGNED NOT NULL ,
`stock_id` SMALLINT( 4 ) UNSIGNED NOT NULL ,
`qty` DECIMAL( 12, 4 ) NOT NULL ,
`stock_status` TINYINT( 3 ) UNSIGNED NOT NULL ,
PRIMARY KEY ( `product_id` , `website_id` , `stock_id` ) ,
CONSTRAINT `FK_CATALOGINVENTORY_STOCK_STATUS_STOCK` FOREIGN KEY ( `stock_id` ) REFERENCES `cataloginventory_stock` ( `stock_id` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT `FK_CATALOGINVENTORY_STOCK_STATUS_PRODUCT` FOREIGN KEY ( `product_id` ) REFERENCES `catalog_product_entity` ( `entity_id` ) ON DELETE CASCADE ON UPDATE CASCADE ,
CONSTRAINT `FK_CATALOGINVENTORY_STOCK_STATUS_WEBSITE` FOREIGN KEY ( `website_id` ) REFERENCES `core_website` ( `website_id` ) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = INNODB DEFAULT CHARSET = utf8

MySQL a répondu:

#1005 - Can’t create table ‘./printibe_magento/cataloginventory_stock_status.frm’ (errno: 150)

 
Magento Community Magento Community
Magento Community
Magento Community
 
jacobs_ny
Jr. Member
 
Total Posts:  13
Joined:  2008-11-30
 

I had the same problem creating the database.. What I did was to change the database type in script to MyISAM and ran the below query in phpMyAdmin. It worked perfectly.. I was able to log back into admin console.  Next, goto to Cache Management and Refresh the Inventory Stock Status. The data from the 3 referenced tables will populate then you can convert table to InnoDB.

[size=1]DROP TABLE IF EXISTS cataloginventory_stock_status
CREATE TABLE cataloginventory_stock_status(
  
product_id int(10unsigned NOT NULL,
  
website_id smallint(5unsigned NOT NULL,
  
stock_id smallint(4unsigned NOT NULL,
  
qty decimal(12,4NOT NULL DEFAULT '0.0000',
  
stock_status tinyint(3unsigned NOT NULL,
  
PRIMARY KEY (product_id,website_id,stock_id),
  
KEY  FK_CATALOGINVENTORY_STOCK_STATUS_STOCK (  stock_id ) ,
  
KEY  FK_CATALOGINVENTORY_STOCK_STATUS_PRODUCT (  product_id ) ,
  
KEY  FK_CATALOGINVENTORY_STOCK_STATUS_WEBSITE (  website_id ) ,
  
CONSTRAINT FK_CATALOGINVENTORY_STOCK_STATUS_STOCK FOREIGN KEY (stock_idREFERENCES cataloginventory_stock (stock_idON DELETE CASCADE ON UPDATE CASCADE,
  
CONSTRAINT FK_CATALOGINVENTORY_STOCK_STATUS_PRODUCT FOREIGN KEY (product_idREFERENCES catalog_product_entity (entity_idON DELETE CASCADE ON UPDATE CASCADE,
  
CONSTRAINT FK_CATALOGINVENTORY_STOCK_STATUS_WEBSITE FOREIGN KEY (website_idREFERENCES core_website (website_idON DELETE CASCADE ON UPDATE CASCADE
ENGINE=MyISAM DEFAULT CHARSET=utf8;[/size]
 
Magento Community Magento Community
Magento Community
Magento Community
 
benfaust
Jr. Member
 
Total Posts:  8
Joined:  2008-02-08
 

I was able to get past the first error using this, but now it’s choking at the amazonpayments_api_debug table, which is in another file. I fixed it, but even deleting the cache does not remove the error (going back to homepage, not hitting refresh).

Who writes these auto-updaters, and don’t they test them first?

Anyone have any idea how many more malformed installer files there are, and how much time I can expect to throw away today? And aren’t there any downloads which contain the fixed versions of these files so everyone doesn’t have to track them down and fix them all manually, or find this thread?

 
Magento Community Magento Community
Magento Community
Magento Community
 
hellsseven
Jr. Member
 
Total Posts:  3
Joined:  2009-04-30
 

Hi there community !

I had the same error , and I tried the fix from tempus fugit here, thanks for that, but now I am getting this error :

Error in file"/www/htdocs/w00a67dd/shop/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php" SQLSTATE[42S02]Base table or view not found1146 Table 'd00b3b64.catalog_product_bundle_selection' doesn't exist
Trace:
#0 /www/htdocs/w00a67dd/shop/app/code/core/Mage/Core/Model/Resource/Setup.php(292): Mage::exception('
Mage_Core', 'Error in file: ...')
#1 /www/htdocs/w00a67dd/shop/app/code/core/Mage/Core/Model/Resource/Setup.php(179): Mage_Core_Model_Resource_Setup->_modifyResourceDb('
upgrade', '0.7.4', '0.7.5')
#2 /www/htdocs/w00a67dd/shop/app/code/core/Mage/Core/Model/Resource/Setup.php(146): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('
0.7.4', '0.7.5')
#3 /www/htdocs/w00a67dd/shop/app/code/core/Mage/Core/Model/Resource/Setup.php(121): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /www/htdocs/w00a67dd/shop/app/code/core/Mage/Core/Model/Config.php(263): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /www/htdocs/w00a67dd/shop/app/code/core/Mage/Core/Model/App.php(263): Mage_Core_Model_Config->init(Array)
#6 /www/htdocs/w00a67dd/shop/app/Mage.php(434): Mage_Core_Model_App->init('', '
store', Array)
#7 /www/htdocs/w00a67dd/shop/app/Mage.php(455): Mage::app('', '
store', Array)
#8 /www/htdocs/w00a67dd/shop/index.php(65): Mage::run()
#9 {main}

What can I do to fix that ?

Thanks for everything , some help would be great appreciated.
hellsseven

 
Magento Community Magento Community
Magento Community
Magento Community
 
nelamurugan
Jr. Member
 
Avatar
Total Posts:  22
Joined:  2009-01-15
Chennai
 


Hi all I was trying for this same problem in the local wamp, i got the same error message but when i cleared all the datas from var directory
/var/cache,var/session,var/report.

So now try it will work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
check01
Jr. Member
 
Total Posts:  16
Joined:  2009-11-25
 

Error in file: “/home/cadeauli/public_html/app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.8.0.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘8uov_core_resource’ already exists

When I open “/home/cadeauli/public_html/app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.8.0.php” there isn’t a table called ‘8uov_core_resource’ ?

How about that?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ategickimi
Jr. Member
 
Total Posts:  10
Joined:  2010-07-15
 

thank you so muchhhhh:)

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageClub
Guru
 
Avatar
Total Posts:  386
Joined:  2009-07-25
India
 

Not able to get past this,

SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_order_status’ already exists

Frustrating! Damn.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top