Description:
I'm having trouble while trying to run this query:
SELECT IDOFERTA , ARTICULO , NOMBRE FROM ((SELECT
articulos.IDARTICULO,ofertas.IDOFERTA,ofertas.NOMBRE,ofertas.PRECIO,ofertas.FECH
AINICIO,ofertas.FECHAFIN,ofertas.TEXTO,articulos.ARTICULO,artcat.IDCATEGORIA
FROM articulos
INNER JOIN artcat ON articulos.IDARTICULO = artcat.IDARTICULO
INNER JOIN ofertas ON articulos.IDARTICULO = ofertas.IDARTICULO
WHERE ofertas.FECHAINICIO <= CURDATE() AND ((ofertas.FECHAFIN >= CURDATE()) OR
(ofertas.FECHAFIN IS NULL))) AS ofertasCat) ;
it causes the mysqld service to crash with no error report (after the results
are correctly returned).
I've tried the query on both jdbc connector and MySQL control center with
identical results.
How to repeat:
CREATE TABLE Articulos (
IDARTICULO int NOT NULL ,
ARTICULO varchar (25) NOT NULL ,
DESCRIPCION text ,
INFOTECNICA text ,
FOTO blob,
PRECIO float NOT NULL ,
UNIDADES int DEFAULT 0 NOT NULL ,
REFERENCIA varchar (10) NOT NULL
) TYPE = InnoDB;
CREATE TABLE ArtCat (
IDCATEGORIA int NOT NULL ,
IDARTICULO int NOT NULL
) TYPE = InnoDB;
CREATE TABLE Ofertas (
IDOFERTA int NOT NULL,
IDARTICULO int NOT NULL,
PRECIO float NOT NULL,
FECHAINICIO datetime NOT NULL,
FECHAFIN datetime,
NOMBRE varchar(50) NOT NULL,
TEXTO text
)TYPE = InnoDB;
ALTER TABLE Articulos ADD
CONSTRAINT PK_Articulos PRIMARY KEY
(
IDARTICULO
);
ALTER TABLE ArtCat ADD
CONSTRAINT PK_ArtCat PRIMARY KEY
(
IDCATEGORIA,
IDARTICULO
);
CREATE INDEX IndiceArt ON ArtCat (IDARTICULO);
ALTER TABLE ArtCat ADD
CONSTRAINT FK_ArtCat_Articulos FOREIGN KEY
(
IDARTICULO
) REFERENCES Articulos (
IDARTICULO
);
CREATE INDEX IndiceOf ON Ofertas(IDARTICULO);
ALTER TABLE Ofertas ADD
CONSTRAINT FK_Ofertas_Art FOREIGN KEY(
IDARTICULO
)REFERENCES Articulos(
IDARTICULO
);
SELECT IDOFERTA , ARTICULO , NOMBRE FROM ((SELECT
articulos.IDARTICULO,ofertas.IDOFERTA,ofertas.NOMBRE,ofertas.PRECIO,ofertas.FECH
AINICIO,ofertas.FECHAFIN,ofertas.TEXTO,articulos.ARTICULO,artcat.IDCATEGORIA
FROM articulos
INNER JOIN artcat ON articulos.IDARTICULO = artcat.IDARTICULO
INNER JOIN ofertas ON articulos.IDARTICULO = ofertas.IDARTICULO
WHERE ofertas.FECHAINICIO <= CURDATE() AND ((ofertas.FECHAFIN >= CURDATE()) OR
(ofertas.FECHAFIN IS NULL))) AS ofertasCat) ;
This SQL code causes the mysqld to crash without any data in the tables but with any data in the tables the server crash too.
Allways you try to run this query causes mysqld service to crash.
If I drop the third condition, it works ok. Same if I use a different operator
than "IS NULL", or if I drop the first two conditions.