Jump to content

Strange db problems! Urgent help needed.


Recommended Posts

Hi there,

 

I've installed and configured a little prestashop in local and have uploaded to a hosting. While I've been configuring furthermore in hosting, I got a strange error, that I think, it's only me got this problem. Because when I searched in google, I saw only my topic on this forum's another section about the problem and nothing else relevant to the problem. The strange problem is a database exception as "Table 'ps_product_reductions' already exists". I wrote the problem this forum and no one has answered. 

 

the screenshot of the error:

post-1068971-0-06795400-1441066143_thumb.png

 

Then I thoght that, altough I would lost some work, it's better to reupload. And I turned to my localhost. While I was making arrangements to move the site to another server, I got the same error in localhost. This made me really crazy! I was thinking that I was cursed, then I decided to delete db, and to create again and import the backup on both localhost and hosting. When I did this, The problem didn't solved in localhost, it's still there. However, I got even worse situation than previous: I can not connect new database by prestashop! The error I faced is "Link to database cannot be established: SQLSTATE[42000] [1049] Unknown database 'cshop'". However, I could connect phpmyadmin by using exactly same parameters. To be sure I wrote a quick php with mysqli_connection exactly the same parameters in settings.inc.php and uploaded to hosting. This php can connect with no problem.

 

I think I'm really cursed. Please somebody help me, and I need urgently. 

Link to comment
Share on other sites

This is a temporary table that the Product class is creating.  The expectation is that a temporary table is automatically dropped/deleted when the connection to the database is closed.  It appears that for some reason the temp table was not deleted.

 

So the first thing you can do is just open phpmyadmin, and drop the ps_product_reductions table.

 

Then continue to work on the site and see if this issue appears again.

 

The usage of this temp table is new as of v1.6.1, so it was probably not tested very well by the developers.  So my advice would be to create a forge ticket and report the issue to them so it can be properly addressed

  • Like 1
Link to comment
Share on other sites

This is a temporary table that the Product class is creating.  The expectation is that a temporary table is automatically dropped/deleted when the connection to the database is closed.  It appears that for some reason the temp table was not deleted.

 

So the first thing you can do is just open phpmyadmin, and drop the ps_product_reductions table.

 

Then continue to work on the site and see if this issue appears again.

 

The usage of this temp table is new as of v1.6.1, so it was probably not tested very well by the developers.  So my advice would be to create a forge ticket and report the issue to them so it can be properly addressed

 

Thanks for your kind help. I've solved "Link to database cannot be established: SQLSTATE[42000] [1049] Unknown database 'cshop'" problem. However, "Table 'ps_product_reductions' already exists" problem still stays. Really strange part is there is no such table in phpmyadmin. When I try to drop the table, error message "#1051 - Unknown table 'ps_product_reductions'" returns. I think this is a really big bug.

Link to comment
Share on other sites

as I explained, temp tables are being created and then mysql server will automatically delete them when the connection is closed.

 

so by the time you went to delete it, mysql had already deleted it.

 

trust me, it is still a bug that you should report to the Forge.  you will most likely encounter the issue again

Link to comment
Share on other sites

Same problem here after canceling a payment

 

[PrestaShopDatabaseException]

 

Table 'ps_product_reductions' already exists

 

 

CREATE TEMPORARY TABLE `ps_product_reductions` (id_product INT UNSIGNED NOT NULL DEFAULT 0, id_product_attribute INT UNSIGNED NOT NULL DEFAULT 0) ENGINE=MEMORY

 

at line 791 in file classes/db/Db.php

 

786. if ($webservice_call && $errno) {

787. $dbg = debug_backtrace();

788. WebserviceRequest::getInstance()->setError(500, '

 '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);

789. } elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) {

790. if ($sql) {

791. throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');

792. }

793.

794. throw new PrestaShopDatabaseException($this->getMsgError());

795. }

796. }

 

•DbCore->displayError - [line 425 - classes/db/Db.php] - [1 Arguments]

•DbCore->query - [line 601 - classes/db/Db.php] - [1 Arguments]

•DbCore->execute - [line 2379 - classes/Product.php] - [2 Arguments]

•ProductCore::getRandomSpecial - [line 104 - modules/blockspecials/blockspecials.php] - [1 Arguments]

•BlockSpecials->hookRightColumn - [line 587 - classes/Hook.php] - [1 Arguments]

•HookCore::coreCallHook - [line 544 - classes/Hook.php] - [3 Arguments]

•HookCore::exec - [line 582 - classes/controller/FrontController.php] - [2 Arguments]

•FrontControllerCore->initContent - [line 34 - modules/paynl_paymentmethods/controllers/front/return.php]

•paynl_paymentmethodsReturnModuleFrontController->initContent - [line 189 - classes/controller/Controller.php]

•ControllerCore->run - [line 367 - classes/Dispatcher.php]

•DispatcherCore->dispatch - [line 28 - index.php]

 

 

I will delete the column manually and see if i can reproduce

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...