Jeremy Evans:

> Yes. On MySQL, String is varchar(255), while String :text=>true is
> text. On PostgreSQL, String is text and String :text=>false is varchar
> (255). This is because MySQL's text type has limitations most users
> would find unacceptable as the standard string type (e.g. you can't
> set a default). On PostgreSQL, text doesn't have additional
> restrictions over varchar(255), so it is used as the additional
> capacity makes it a better fit for Ruby's String class (which doesn't
> have a length restriction of 255 characters).

Correct me if I’m wrong, but last time I checked SQLite’s varchar(255)
can actually store longer strings (does not complan and returns them as
stored, i.e., not truncated).

This means that String fields are not truncated on SQLite and PostgreSQL
while being truncated on MySQL – and if I really want to to have
a cross-database column for storing long strings I need to use either
‘:text’ field type (instead of ‘String’) or ‘String, :text => true’,
right?

— Piotr Szotkowski
-- 
Natural selection saw to it that professional heroes who at a crucial
moment tended to ask themselves questions like ‘What is my purpose in
life?’ very quickly lacked both. [Terry Pratchett, Interesting Times]

Attachment: signature.asc
Description: Digital signature

Reply via email to