-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when importing exported view with USE INDEX hint #18566
Labels
Milestone
Comments
Hi @M393 |
Can you provide a screenshot for this @M393? |
I don't think it is a parser bug. This can be resolved by exporting indexes before views. See the exported file: -- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Jul 24, 2023 at 05:21 PM
-- Server version: 5.7.38-log
-- PHP Version: 8.1.13
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `s`
--
-- --------------------------------------------------------
--
-- Table structure for table `t`
--
CREATE TABLE `t` (
`id` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Stand-in structure for view `v`
-- (See below for the actual view)
--
CREATE TABLE `v` (
`id` int(11)
,`name` varchar(45)
);
-- --------------------------------------------------------
--
-- Structure for view `v`
--
DROP TABLE IF EXISTS `v`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS SELECT `t`.`id` AS `id`, `t`.`name` AS `name` FROM `t` USE INDEX (`t_name`) ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `t`
--
ALTER TABLE `t`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `t_name` (`name`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `t`
--
ALTER TABLE `t`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
Thanks, I better understand the error now with your screenshot |
williamdes
added a commit
that referenced
this issue
Apr 28, 2024
Signed-off-by: William Desportes <williamdes@wdes.fr>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
CREATE VIEW statements are written to the exported sql before indexes, when the view uses
USE INDEX (...)
import fails.To Reproduce
Steps to reproduce the behavior:
DROP SCHEMA s; CREATE SCHEMA s; USE s;
Expected behavior
Should be able to execute exported sql without error.
Server configuration
The text was updated successfully, but these errors were encountered: