sqlite does not enforce types/length, or uniqueness.

You can insert a string into an integer field for all sqlite is concerned.

--
Thadeus





On Thu, Apr 15, 2010 at 3:17 PM, Keith Edmunds <[email protected]> wrote:
> I have the following (sqlite) table definition:
>
> db.define_table('companies',
>    Field('name', length=512, default='', unique=True),
>    Field('oncontract', 'boolean', default=False)
> )
>
> From the admin app, I am prevented from adding duplicate company names.
> However, from the shell, a sequence of:
>
> db.companies.insert(name="test")
> db.commit()
> db.companies.insert(name="test")
> db.commit()
>
> ...gives no errors and does insert duplicates.
>
> The book says, section 6.4, "unique=True translates into the "UNIQUE" SQL
> statement. It asks the database to make sure that values of this field are
> unique within the table."
>
> That doesn't appear to match the behaviour I'm seeing. Bug, feature,
> misunderstanding on my part?
>
> Thanks,
> Keith
>
>
> --
> To unsubscribe, reply using "remove me" as the subject.
>

Reply via email to