Search code examples
mysqltimestampworkbench

Why do I get Error Code: 1292 in a specific range?


I'm getting this Error Code: 1292 during attempt to assign values from range '2016-03-27 02:00:00' to '2016-03-27 2:59:59'. I use TIMESTAMP as variable type and MySQL Workbench. All other dates(and hours) seems to work properly. I don't get it why is that happening... Is it some kind of BUG in this environment or SQL or am I missing something? Asking just out of curiosity:)

Table definition:

CREATE TABLE sales_order(
cust_id INT UNSIGNED NOT NULL,
sales_person_id INT UNSIGNED NOT NULL,
FOREIGN KEY(cust_id)
    REFERENCES customer(id),
FOREIGN KEY(sales_person_id)
    REFERENCES sales_person(id),
time_order_taken TIMESTAMP NOT NULL,
purchase_order_number BIGINT NOT NULL,
credit_card_number VARCHAR(16) NOT NULL,
credit_card_expir_month TINYINT NOT NULL,
credit_card_expir_year TINYINT NOT NULL,
credit_card_secret_code SMALLINT NOT NULL,
name_on_card VARCHAR(60) NOT NULL,
id INT UNSIGNED NOT NULL
AUTO_INCREMENT PRIMARY KEY);

Query:

INSERT INTO sales_order VALUES 
(15, 4, '2016-03-27 02:18:18', 2016327218, 7798214190926405, 5, 13, 809, 'Stephanie Taylor', NULL);

Solution

  • That's when we changed from Standard Time to Daylight Saving Time in 2016. The time jumped from 01:59:59 to 03:00:00. So any time between them doesn't exist.