Field timestamp does not insert in Mariadb

Asked

Viewed 34 times

0

I have a local server to program using shaman and his database is mariaDB. I made a system that inserts a record in the table but the data_separation field is a timestamp that by default is NULL.

At some point I select the fields of this table, including the data_separation that is null and need to insert into another table with the same field. In system logic this field may have been filled in at some point, but usually it is null.

INSERT INTO faturamento_item (id, cliente, produto, sequencia, tamanho, data_separacao, valor_total, situacao) VALUES (17027, 1263, 3569, 5, 22, '', 24.55,1);

If I do this on my xampp server it works normally and just gives me a notification:

Truncated data for data_separator column'

But I set up mariaDB on Amazon’s RDS, with my same bench structure. I drew from mine and I rode on RDS. But the database does not accept, it gives the error:

Incorrect datetime value: '' for column banco_dados.faturamento_item.data_separacao

Someone knows if they can configure something in the RDS database to accept the input field. Because xampp works and RDS doesn’t?

  • 1

    There are cases where the bank can interpret null and void in different ways, especially when it comes to date, Bruno. Instead of putting empty quotes type null in the query and do a test.

  • I just wanted to avoid that. If there were any configuration in the database to accept this type of insertion would be ideal, otherwise I would have to treat the null fields every time.

  • If you have I don’t know. switch to null solved the problem?

  • But what’s the difference between null and empty? you will both need processing in your query

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.