[Lazarus] Lazarus, Jedi etc.
Michael Van Canneyt
michael at freepascal.org
Mon Jul 15 17:49:35 CEST 2013
On Mon, 15 Jul 2013, Henry Vermaak wrote:
> On Mon, Jul 15, 2013 at 04:37:35PM +0200, Michael Van Canneyt wrote:
>> On Mon, 15 Jul 2013, Henry Vermaak wrote:
>>> Could you explain why the above is bad for those of us that aren't DB
>>> experts? To my untrained eye it looks fairly plausible, so I'm
>>> obviously missing something.
>>
>> Simple. The statement
>>
>> create table a (b int not null, c int not null);
>>
>> creates a table called 'a', in which the fields b and c are required.
>> that is, they cannot be NULL.
>>
>> mysql> insert into a (b) values (1);
>>
>> Attempts to insert a record with value NULL for C, which is
>> explicitly forbidden by the definition of the table.
>
> 0 != NULL, it's inserting the default value for the field, which seems
> to be 0 for an integer field.
There is no default value specified.
You MUST specify a default value if you want one.
If you didn't specify one, the Database engine should not apply one on its own.
> Does e.g. postgres error on an insert statement like this?
Yes. As does firebird.
Michael.
More information about the Lazarus
mailing list