Re: [Modeling-users] varchar and text
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2003-06-12 22:37:37
|
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 with > 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 h= ow > other database system treat this. MySQL: http://www.mysql.com/doc/en/CHAR.html, no CHAR/VARCHAR w/o width SQLite: accepts varchar without limit 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 :) 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. 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: << 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). >> -- S=E9bastien. |