Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-3794

temporary table don't execute like normal table

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 5.5.25-galera
    • Fix Version/s: None
    • Component/s: None
    • 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?

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            rspadim roberto spadim added a comment -

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

            to

            CREATE TEMPORARY TABLE `ROTAS_21a17623d58902237b1cea833b4c4e14` (

            Show
            rspadim roberto spadim added a comment - the error occur when i change: CREATE TABLE `ROTAS_21a17623d58902237b1cea833b4c4e14` ( to CREATE TEMPORARY TABLE `ROTAS_21a17623d58902237b1cea833b4c4e14` (
            Hide
            serg Sergei Golubchik added a comment -
            Show
            serg Sergei Golubchik added a comment - This is the expected behavior, see http://dev.mysql.com/doc/refman/5.5/en/temporary-table-problems.html
            Hide
            rspadim roberto spadim added a comment -

            ohhhh :/ sorry bad manual

            but it´s a real necessary limitation?

            Show
            rspadim roberto spadim added a comment - ohhhh :/ sorry bad manual but it´s a real necessary limitation?

              People

              • Assignee:
                Unassigned
                Reporter:
                rspadim roberto spadim
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: