← Back to team overview

maria-discuss team mailing list archive

Re: Disable validation for `DATETIME` columns

 

Hi, William,

On Apr 02, William Edwards wrote:
> Hi Sergei,
> 
> Sergei Golubchik schreef op 2023-03-30 14:54:
> > Hi, William,
> > 
> > Could you provide a sequence of SQL commands demonstrating what
> > exactly is not working?
> > 
> > I've just tried and I was able to insert '2023-03-26 02:30:00' into
> > a DATETIME column just fine.
> 
> After consulting with the customer, it turns out that the error indeed
> does NOT occur with `DATETIME` columns. However, according to the
> documentation[1], it should.

Thanks. The documentation is wrong, we'll fix it.

> The issue does occur with `TIMESTAMP` columns. However, this behaviour 
> is not mentioned in the documentation[2].

It is, in a way.

  If a column uses the TIMESTAMP data type, then any inserted values are
  converted from the session's time zone to Coordinated Universal Time
  (UTC) when stored, and converted back to the session's time zone when
  retrieved

So when you use a DATETIME literal that does not correspond to any point
in time in UTC, the conversion fails and you get an error.

Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx


References