Hi,
This has been changed in CVS and will be in next release: a CHAR/VARCHAR =
w/o
width no longer produces a message at the ERROR level, rather at the INFO
level, when the underlying db supports it (i.e. Postgresql, SQLite).
-- S=E9bastien.
Sebastien Bigaret <sbi...@us...> wrote:
> Ernesto Revilla <er...@si...> wrote:
> > Going thru the PostgreSQL doc version 7.3.2 it says:
> > * varchar w/o upper limit is not standard SQL
> > * text is postgres specific
> > * varchar w/o limit and text have no performance penalities compared wi=
th
> > varchar with limit
> > * a lot of modern dbms systems support unlimited text.
> >=20
> > What's about mySQL? I would like to see if the the width requirement of
> > varchar would be loosened (perhaps a warning, or ignored). I don't know=
how
> > other database system treat this.
>=20
> MySQL: http://www.mysql.com/doc/en/CHAR.html, no CHAR/VARCHAR w/o width
> SQLite: accepts varchar without limit
>=20
> ModelValidation issues an error when a varchar column is declared
> without a width, however that does not prevent you to
> mdl_generate_DB_schema: if the db underneath supports it, everything
> will be fine :)
>=20
> I agree, however, that ModelValidation should reflect the db
> specificities when possible. This will be changed in a near future so
> that it issues a message at the 'info' level (rather than 'error') for
> rdbms supporting it.
>=20
> See also the note I recently added to the User's Guide about the
> 'width' parameter (will be online for the next release), depicting the
> role played by 'width' at runtime:
>=20
> << Note: The field width is used at runtime when validating a string
> attribute's value (see 3.4, ``Validation''), before objects are saved
> in the database. SQL data types CHAR and VARCHAR require that width
> is specified; on the other hand, TEXT -when supported by the
> database- does not accept that width is set. If you set it on an
> attribute, it will be ignored when the database schema is generated
> (i.e. a TEXT field my_text with width=3D30 won't be declared as
> TEXT(30), but simply as TEXT), but it will be checked at runtime and
> validation for this attribute will fail if its value's length exceeds
> the given width. Note that the same goal can be achieved by writing a
> specific validation method for the attribute (see 3.4.2).
> >>
>=20
> -- S=E9bastien.
|