Bug #39850 | temp table problems | ||
---|---|---|---|
Submitted: | 4 Oct 2008 8:14 | Modified: | 8 Oct 2008 20:11 |
Reporter: | Peter Laursen (Basic Quality Contributor) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server | Severity: | S4 (Feature request) |
Version: | any | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | qc |
[4 Oct 2008 8:14]
Peter Laursen
[4 Oct 2008 19:11]
Martin Friebe
As for the documentation, it is mentioned in the "create table" page at http://dev.mysql.com/doc/refman/5.0/en/create-table.html <quote> You can use the TEMPORARY keyword when creating a table. A TEMPORARY table is visible only to the current connection, and is dropped automatically when the connection is closed. This means that two different connections can use the same temporary table name without conflicting with each other or with an existing non-TEMPORARY table of the same name. (The existing table is hidden until the temporary table is dropped.) To create temporary tables, you must have the CREATE TEMPORARY TABLES privilege. </quote> Especially the part: " without conflicting with each other or with an existing non-TEMPORARY table of the same name. (The existing table is hidden until the temporary table is dropped.)" Hope it helps. It may be that the docs could be rephrased, as I can not see, how the "2 connection" bit relates to the "temporary vs non-temp" bit?
[4 Oct 2008 19:53]
Peter Laursen
ok that passage I overlooked .. but 1) It is OK that different connections can create same temp table - obviously. But I think a 'global' table and a tmep table should not create if a table wiht the same name si allready avail to the connection. Also I do not understand that the current implementation is described as 'non-conflicting'. I think the opposite - It is definitely 'conflicting' as I cannot access the 'global' table! 2) How do I know that a temporary table exists duplicating a 'global' table? Of course I can execute SHOW TABLES or similar but it is ineffective in terms of application programming to perform tests that should be unnessary because they should have been implemented in server 2) How can I test the existence of a temp table before dropping it? 3) How do I know what temporary tables exist for my connection? All this is not possible. So I need a notebook and a pencil to record all such things if I want to use MySQL (I can have a connection open for weeks and may have created hundreds of temporary tables and forgot which ones were dropped!)? I read the docs as an attempt to justify an architectural flaw only! I'd prefer docs did not try to decorate the current situation using abstract and positive terms like 'no conflict' (how nice, when described like this - we do not like 'conflicts', right!) but *in plain words* told the limitatations/risks for user/client because of this! Such as the risk to drop a 'global' table if you by accident drop the same tablename twice by human mistake or bug in application code!
[8 Oct 2008 20:11]
Sveta Smirnova
Thank you for the reasonable feature request. Possible solution: add a statement which allow to examine if one created temporary table.