Table doesn't exist error in Magento - magento-1.9

The issue is,
a:5:{i:0;s:391:"SQLSTATE[42S02]: Base table or view not found: 1146
Table 'mohchaii_mage828.mgmu_tag_summary' doesn't exist, query was:
SELECT
tag_summary.popularity, tag.* FROM mgmu_tag_summary AS tag_summary
INNER JOIN mgmu_tag AS tag ON tag.tag_id = tag_summary.tag_id AND
tag.status = 1 WHERE (tag_summary.store_id = '1') AND (tag_summary.products
> 0) ORDER BY popularity DESC LIMIT 20";i:1;s:4257:"#0
/home/mohchaiinfusion/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
Any help is appreciated.

Log in to the Magento Admin.
Click System > Index Management.
Select the check box next to each type of indexer to change.
From the Actions list, click the indexing mode.
Click Submit. than working because this error is index management

This type of error basically arises when you are trying to run a query on a table that doesn't exists. So first you need to see whether the particular table is there in the database or not. If it is present flush all the cache and try running all the reindexing.

Related

OPENQUERY SQL Server MYSQL UPDATE

I have to work on a linked server. My goal: Update an entire table in mysql server(version:8.0.21) via OPENQUERY in SQL Server(version 13.0.1742.0). I tried this but it generates an error Row cannot be located for updating. Some values may have been changed since it was last read and this one The rowset was using optimistic concurrency and the value of a column has been changed after the containing row was last fetched or resynchronized.
update linkedTable
set
linkedTable.id_parent=unlinkedTable.IdCat1,
linkedTable.code=unlinkedTable.CodeFamilleFAT,
linkedTable.niveau=unlinkedTable.NiveauCategorieFAT,
linkedTable.langue=unlinkedTable.CodeLangueFAT,
linkedTable.nom=unlinkedTable.LibelleCommercialFAT,
linkedTable.descriptionA=unlinkedTable.DescriptifCom1FAT,
linkedTable.vignette=null,
linkedTable.id_categorie=unlinkedTable.id
from openquery(NAMELINKEDSERVER, 'select id_categorie, id_parent, code, niveau, langue, nom, description as descriptionA, vignette from DatabaseMySQL.Table') as linkedTable
inner join DatabaseSQLserver.dbo.Table as unlinkedTable on unlinkedTable.Id = linkedTable.id_categorie
Then I tried this:
update linkedTable
set
linkedTable.id_parent=unlinkedTable.IdCat1,
linkedTable.code=unlinkedTable.CodeFamilleFAT,
linkedTable.niveau=unlinkedTable.NiveauCategorieFAT,
linkedTable.langue=unlinkedTable.CodeLangueFAT,
linkedTable.nom=unlinkedTable.LibelleCommercialFAT,
linkedTable.descriptionA=unlinkedTable.DescriptifCom1FAT,
linkedTable.vignette=null,
linkedTable.id_categorie=unlinkedTable.id
from openquery(NAMELINKEDSERVER, 'select id_categorie, id_parent, code, niveau, langue, nom, description as descriptionA, vignette from DatabaseMySQL.Table') as linkedTable
inner join DatabaseSQLserver.dbo.Table as unlinkedTable on unlinkedTable.Id = linkedTable.id_categorie
where linkedTable.id_categorie = 1
This work but only one row is updated. So I wrote a stored procedure to update each line but it took too much time.
Can someone explain why my first query didn't work (question1) and how I can reduce the time of my stored procedure (question2)?
I use while loop (count the number of id and update each id).
Thank you in advance.
Kind Regards.
I resolve the problem by checking some option on ODBC Driver in MySQL and reading some forum. I check this box.
enter image description here
This option allows to avoid the errors quoted previously. With this option, i can update multiple values without error on join or other request. Thank you Solarflare and "Another guy" (i lost the name) for correcting me (EDIT A POST). Have nice day both.

PHPMyadmin #1066 - Not unique table/alias error only export

I'm actually having an issue with PHPMyAdmin :
I can execute my SQL query with nice result
I get an error when I'm trying to export the same query
Here's the query :
SELECT pn.nomenclature_id as nomenclature_id, pn.lettre as lettre, a.reference as reference_article, at.nom as nom_article
FROM item a, item_translation at, item_nomenclature an, item_nomenclature pn, item p
WHERE a.type = 1
AND a.id = at.id
AND at.lang = 'fr'
AND a.id = an.item_id
AND an.nomenclature_id = pn.nomenclature_id
AND pn.item_id = p.id
AND p.type = 2
AND p.marque_id = 2
Here's a video where I had the problem : https://youtu.be/Z5AAZhoX6W0
There's lot of thread on Not unique table/alias error but I didn't found any reason to explain why the query works in PHPMyAdmin "SQL" tab but not with export.
Thanks for your support,
David.
For anyone running into this same issue and not able to apply the fix mentioned in the github issue for whatever reason (I'm working on a VPS currently where I have no access to the phpMyAdmin install).
A simple workaround is to first create a view from your query result, then go to that view and export from there. Afterwards you can drop the view again.
(to create the view just run your query but click 'create view' instead of export, fill in a name and leave the rest as is; the view will become available in the left column under the node 'Views' instead of 'Tables')

Replacing existing View but MySQL says "Table doesn't exist"

I have a table in my MySQL database, compatibility_core_rules, which essentially stores pairs of ids which represent compatibility between parts which have fields with those corresponding ids. Now, my aim is to get all possible compatibility pairs by following the transitivity of the pairs (e.g. so if the table has (1,2) and (2,4), then add the pair (1,4)). So, mathematically speaking, I'm trying to find the transitive closure of the compatibility_core_rules table.
E.g. if compatibility_core_rules contains (1,2), (2,4) and (4,9), then initially we can see that (1,2) and (2,4) gives a new pair (1,4). I then iterate over the updated pairs and find that (4,9) with the newly added (1,4) gives me (1,9). At this point, iterating again would add no more pairs.
So my approach is to create a view with the initial pairs from compatibility_core_rules, like so:
CREATE VIEW compatibility_core_rules_closure
AS
SELECT part_type_field_values_id_a,
part_type_field_values_id_b,
custom_builder_id
FROM compatibility_core_rules;
Then, in order to iteratively discover all pairs, I need to keep replacing that view with an updated version of itself that has additional pairs each time. However, I found MySQL doesn't like me referencing the view in its own definition, so I make a temporary view (with or replace, since this will be inside a loop):
CREATE OR REPLACE VIEW compatibility_core_rules_closure_temp
AS
SELECT part_type_field_values_id_a,
part_type_field_values_id_b,
custom_builder_id
FROM compatibility_core_rules_closure;
No problems here. I then reference this temporary view in the following CREATE OR REPLACE VIEW statement to update the compatibility_core_rules_closure view with one iteration's worth of additional pairs:
CREATE OR REPLACE VIEW compatibility_core_rules_closure
AS
SELECT
CASE WHEN ccr1.part_type_field_values_id_a = ccr2.part_type_field_values_id_a THEN ccr1.part_type_field_values_id_b
WHEN ccr1.part_type_field_values_id_a = ccr2.part_type_field_values_id_b THEN ccr1.part_type_field_values_id_b
END ccrA,
CASE WHEN ccr1.part_type_field_values_id_a = ccr2.part_type_field_values_id_a THEN ccr2.part_type_field_values_id_b
WHEN ccr1.part_type_field_values_id_a = ccr2.part_type_field_values_id_b THEN ccr2.part_type_field_values_id_a
END ccrB,
ccr1.custom_builder_id custom_builder_id
FROM compatibility_core_rules_closure_temp ccr1
INNER JOIN compatibility_core_rules_closure_temp ccr2
ON (
ccr1.part_type_field_values_id_a = ccr2.part_type_field_values_id_a OR
ccr1.part_type_field_values_id_a = ccr2.part_type_field_values_id_b
)
GROUP BY ccrA,
ccrB
HAVING -- ccrA and ccrB are in fact not the same
ccrA != ccrB
-- ccrA and ccrB do not belong to the same part type
AND (
SELECT ptf.part_type_id
FROM part_type_field_values ptfv
INNER JOIN part_type_fields ptf
ON ptfv.part_type_field_id = ptf.id
WHERE ptfv.id = ccrA
LIMIT 1
) !=
(
SELECT ptf.part_type_id
FROM part_type_field_values ptfv
INNER JOIN part_type_fields ptf
ON ptfv.part_type_field_id = ptf.id
WHERE ptfv.id = ccrB
LIMIT 1
)
Now this is where things go wrong. I get the following error:
#1146 - Table 'db509574872.compatibility_core_rules_closure' doesn't exist
I'm very confused by this error message. I literally just created the view/table only two statements ago. I'm sure the SELECT query itself is correct since if I try it by itself and it runs fine. If I change the first line to use compatibility_core_rules_closure2 instead of compatibility_core_rules_closure then it runs fine (however, that's not much use since I need to be re-updating the same view again and again). I've looked into the SQL SECURITY clauses but have not had any success. Also been researching online but not getting anywhere.
Does anyone have any ideas what is happening and how to solve it?
MySQL doesn't support sub-queries in views.
You'll have to separate them... ie. using another view containing the sub-query inside you main view.
Running the create statement for that view will render an error, not creating it, hence the doesn't exist error you're getting when querying it.

Why is my testlink install experiencing this MySQL error?

I have configured the testlink on my local machine. Everything is working fine expect while selecting "Requirements based Report" from "Result" menu it showing the following DB Access Error.
DB Access Error - debug_print_backtrace() OUTPUT START
==============================================================================
#0 database->exec_query(SELECT id FROM xp_executions WHERE tcversion_id=(SELECT id FROM xp_nodes_hierarchy WHERE parent_id='0') ORDER BY id DESC LIMIT 0,1, -1) called at [D:\wamp\www\testlink\lib\functions\database.class.php:535]
#1 database->fetchRowsIntoMap(SELECT id FROM xp_executions WHERE tcversion_id=(SELECT id FROM xp_nodes_hierarchy WHERE parent_id='0') ORDER BY id DESC LIMIT 0,1, id, 1) called at [D:\wamp\www\testlink\lib\results\resultsReqs.php:103]
==============================================================================
I have searched on google regarding DB Access Error - debug_print_backtrace() OUTPUT START error but didn't found any solution on it.
My primary question is what is debug_print_backtrace() error and why its coming? and second is how can I remove it?

Select from View using Where clause to refer to another database - Unknown Column error

I am trying to select certain values from a view that I created. The statement is below:
SELECT * FROM dashboard.team
WHERE ac2012.acx_users.id = 1;
As you can see, there are 2 databases being referenced here:
dashboard database, team table
ac2012 database, acx_users.id table
ac2012.acx_users.id is the regular expression in the original Create View statement, I'm using that since of course I can't use an ALIAS in a Where clause... however, this is showing an error:
Error Code 1054: Unknown column 'ac2012.acx_users.id' in 'where clause'
I'm not sure how to get this to work, because I need to reference the other database in this case, but it's not recognizing the database. Any tips would be appreciated.
Since you're selecting from a view, the underlying databases aren't visible anymore. You only see what the view presents, as part of the database which the view lives in, so try WHERE acx_users.id = 1, or whatever you've aliased that field to in the view definition.
SELECT * FROM dashboard.team
LEFT OUTER JOIN ac2012 ON ac2012.CommonColumnName=dashboard.CommonColumnName
WHERE ac2012.acx_users.id = 1;
======================
Please replace by original column name ...