[MDEV-3794] temporary table don't execute like normal table Created: 2012-10-04  Updated: 2012-10-04  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.25-galera
Fix Version/s: None

Type: Bug Priority: Major
Reporter: roberto spadim Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

linux



 Description   

hi guys i'm trying to execute this query:

CREATE TABLE `ROTAS_21a17623d58902237b1cea833b4c4e14` (
`plano_conta_id` bigint(20) NOT NULL DEFAULT '0',
`plano_conta_id_red` bigint(20) NOT NULL DEFAULT '0',
`plano_conta_numero` varchar(255) NOT NULL DEFAULT '',
`descricao` varchar(255) NOT NULL DEFAULT '',
`habilitado` enum('Y','N') NOT NULL DEFAULT 'Y',
`tipo` enum('','-') NOT NULL DEFAULT '',
`comp_automatico_tipo` enum('bc','pess','bc-pre','pess-pre','est','est-pre','') NOT NULL DEFAULT '',
`comp_automatico` varchar(255) NOT NULL DEFAULT '',
`contabil_tipo_conta` varchar(255) NOT NULL,
`contabil_tipo_saldo` enum('d','c','','0') NOT NULL,
`contabil_tipo_lancamentos` enum('d','c','dc') NOT NULL,
PRIMARY KEY (`plano_conta_id`,`plano_conta_numero`),
UNIQUE KEY `NewIndex` (`plano_conta_id`,`plano_conta_id_red`)
)
;
SELECT a.pessoa_tipo,a.pessoa_id,a.spavendas_vendedor_tipo,a.spavendas_vendedor_id,a.spavendas_tbl_preco,a.cfop_vendas_id,a.cfop_vendas_id_red,a.spacompra_vendedor_tipo,a.spacompra_vendedor_id,a.cfop_compra_id,a.cfop_compra_id_red,(SELECT plano_conta_numero FROM ROTAS_21a17623d58902237b1cea833b4c4e14 WHERE plano_conta_id=a.rota_distribuicao_id AND plano_conta_id_red=a.rota_distribuicao_id_red) AS rota_numero,(SELECT descricao FROM ROTAS_21a17623d58902237b1cea833b4c4e14 WHERE plano_conta_id=a.rota_distribuicao_id AND plano_conta_id_red=a.rota_distribuicao_id_red) AS rota_desc,a.rota_distribuicao_sequencia,'j' AS distribuidor_tipo,id AS distribuidor_id,IF(a.pessoa_tipo='f',(SELECT (pais_entrega || uf_entrega || municipio_entrega || bairro_entrega || endereco_entrega_rua || endereco_entrega_numero || endereco_entrega_complemento) AS tmp_end FROM pessoa_fisica WHERE id=a.pessoa_id),(SELECT (pais_entrega || uf_entrega || municipio_entrega || bairro_entrega || endereco_entrega_rua || endereco_entrega_numero || endereco_entrega_complemento) AS tmp_end FROM pessoa_juridica WHERE id=a.pessoa_id)) AS end_2,IF(a.pessoa_tipo='f',(SELECT IF(habilitada!='a','Y','N') FROM pessoa_fisica WHERE id=a.pessoa_id),(SELECT IF(habilitada!='a','Y','N') FROM pessoa_juridica WHERE id=a.pessoa_id)) AS desabilitado,IF(a.pessoa_tipo='f',(SELECT vendas_bloqueada FROM pessoa_fisica WHERE id=a.pessoa_id),(SELECT vendas_bloqueada FROM pessoa_juridica WHERE id=a.pessoa_id)) AS vendas_bloqueada,(SELECT plano_conta_numero FROM ROTAS_21a17623d58902237b1cea833b4c4e14 WHERE plano_conta_id=a.rota_comercial_id AND plano_conta_id_red=a.rota_comercial_id_red) AS rota_comercial_numero,(SELECT descricao FROM ROTAS_21a17623d58902237b1cea833b4c4e14 WHERE plano_conta_id=a.rota_comercial_id AND plano_conta_id_red=a.rota_comercial_id_red) AS rota_comercial_descricao,a.rota_comercial_sequencia,a.data_ultima_venda FROM pessoa_juridica_mov AS a WHERE id=1 AND spavendas_vendedor_id=0 ORDER BY desabilitado,vendas_bloqueada,data_ultima_venda,spavendas_vendedor_tipo,IF(spavendas_vendedor_id=0,100000000,spavendas_vendedor_id),rota_numero,rota_distribuicao_sequencia,pessoa_tipo,pessoa_id

it runs fine it table isn't temporary
when it's temporary the error is :
/* SQL Error (1137): Não pode reabrir a tabela 'ROTAS_21a17623d58902237b1cea833b4c4e14 */

any idea?



 Comments   
Comment by roberto spadim [ 2012-10-04 ]

the error occur when i change:
CREATE TABLE `ROTAS_21a17623d58902237b1cea833b4c4e14` (

to

CREATE TEMPORARY TABLE `ROTAS_21a17623d58902237b1cea833b4c4e14` (

Comment by Sergei Golubchik [ 2012-10-04 ]

This is the expected behavior, see http://dev.mysql.com/doc/refman/5.5/en/temporary-table-problems.html

Comment by roberto spadim [ 2012-10-04 ]

ohhhh :/ sorry bad manual

but it´s a real necessary limitation?

Generated at Thu Feb 08 06:51:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.