On Tuesday, November 8, 2016 at 7:30:08 AM UTC-8, Samuel Williams wrote: > > Following on from https://github.com/jeremyevans/sequel/issues/1245 > > > Whether or not it is a good idea to use ruby class names for > database-independent types, that's that route Sequel took, and changing it > doesn't make much sense at this point. Do you have a specific > recommendation in this area that is backwards compatible? > > I guess I feel that adding a Sequel::Boolean class and using that would > make more sense to new users. There has been a big discussion here > https://bugs.ruby-lang.org/issues/12515 > If ruby adds a Boolean class, Sequel will support it. However, I don't think that Sequel should add a Sequel::Boolean class.
> > Just so you know, MySQL is not "most databases". Even if most databases > supported 1/2/4/8, what are you supposed to do with size: 7? If you want > to use database specific types, Sequel makes that very easy to do, by just > providing the database specific type name instead of using a ruby class. > > > I'm using SQLite, Postgres and MySQL and all of them support different > size integer data types: > > > Postgres: https://www.postgresql.org/docs/9.1/static/datatype-numeric.html > > MySQL: http://dev.mysql.com/doc/refman/5.7/en/integer-types.html > > SQLite (pretty loose IMHO): http://www.sqlite.org/datatype3.html > Sequel already has generic support for 4-byte and 8-byte integers. Support for generic 2-byte integers is pretty common among databases, so I would consider adding that to Sequel, via an option to the Integer generic type. Other integer sizes are not common as far as I know. > We have some tables which have the better part of a billion records. If we > can shave off a few bytes per record, this can be a big win for both > storage and indexes. > My recommendation in this case would be to use database-specific types, then you get exactly what you want. > Keep in mind that int(8) is actually the display size, not the storage > size. From what I understand, the name of the datatype affects the storage > (e.g. integer vs smallint). It would actually be nice to specify things > like 'unsigned' and 'bytesize' and have this map to the correct internal > datatypes. But, perhaps I'm asking too much? > PostgreSQL doesn't really have unsigned types, and bytesize should in general be the same as the storage size. int8 should be an 8-byte integer on PostgreSQL, I'm not sure how you create an integer column on PostgreSQL that has a different storage size than display size. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
