21 agosto 2007

MySQL 5 secondo Alex Papadimoulis

Ricordate Alex Papadimoulis, il creatore del magnifico Daily WTF? A quanto pare ha anche un blog, in cui ho trovato un'ottima digressione su MySQL 5 e i suoi tradizionali aspetti controversi. Ottimo.

1 commento:

Anonimo ha detto...

Si ma bisogna smitizzare le concezioni errate che la gente ha: non sono bug ma feature.

Da:
http://dev.mysql.com/doc/refman/5.0/en/constraint-invalid-data.html

"If you are not using strict mode, then whenever you insert an “incorrect” value into a column, such as a NULL into a NOT NULL column or a too-large numeric value into a numeric column, MySQL sets the column to the “best possible value” instead of producing an error"

Il server sceglierà per voi il miglior valore possibile! Non vi sentite già sollevati dal dover prendere gravose decisioni?

Inoltre il comportamento cambia a seconda del numero di righe da inserire:

"If you try to store NULL into a column that doesn't take NULL values, an error occurs for single-row INSERT statements. For multiple-row INSERT statements or for INSERT INTO ... SELECT statements, MySQL Server stores the implicit default value for the column data type"

Se fate i bravini ed inserite una riga alla volta allora vi restituirà l'eventuale errore; alrimenti "best value" a valanga.