Pedro Mariano Belo
2007-Jul-03 13:34 UTC
Wrong interpretation of limit in both Mysql and PostgreSQL adapters
Can anyone check this ticket? http://dev.rubyonrails.org/ticket/5489 It''s 1 year old already, but still valid imho. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2007-Jul-04 02:31 UTC
Re: Wrong interpretation of limit in both Mysql and PostgreSQL adapters
> Can anyone check this ticket? > http://dev.rubyonrails.org/ticket/5489 > > It''s 1 year old already, but still valid imho.I don''t quite follow what the problem is with the current implementation? could you give me an example of what bugs / mis-behaviour this patch will prevent? -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Pedro Mariano Belo
2007-Jul-04 14:43 UTC
Re: Wrong interpretation of limit in both Mysql and PostgreSQL adapters
Sure. Well, I was asked to include #5484 into this ticket, so it is dealing with distinct bugs at once. To understand those bugs, let''s begin with a single migration that creates a table with one column: t.column :limit3, :integer, :limit => 3 1) When you run this migration under postgresql, the column is dumped to schema.rb without the limit: t.column "limit3", :integer The patch in this ticket fixes the postgresql adapter to dump columns with limits. 2) Also in postgresql, the above migration will generate a smallint column, which uses 2 bytes for storage. I think it should generate an integer column, so it can handle 3 bytes numbers without overflow -- and this is also covered by the patch attached. 3) Finally, in mysql the migration will generate a INT(3) column, what means a column with display size of 3, and not a column with 3 bytes for storage. The patch changes mysql adapter to use the limit constraint to generate smallint, mediumint, int and bigint columns accordingly. On 7/3/07, Michael Koziarski <michael@koziarski.com> wrote:> > > Can anyone check this ticket? > > http://dev.rubyonrails.org/ticket/5489 > > > > It''s 1 year old already, but still valid imho. > > I don''t quite follow what the problem is with the current > implementation? could you give me an example of what bugs / > mis-behaviour this patch will prevent? > > > -- > Cheers > > Koz > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2007-Jul-07 00:01 UTC
Re: Wrong interpretation of limit in both Mysql and PostgreSQL adapters
> Well, I was asked to include #5484 into this ticket, so it is dealing > with distinct bugs at once.Sounds good. This patch breaks sqlite''s tests, if you can merge those in, it seems good to apply.> To understand those bugs, let''s begin with a single migration that > creates a table with one column: > t.column :limit3, :integer, :limit => 3 > > 1) When you run this migration under postgresql, the column is dumped > to schema.rb without the limit: > t.column "limit3", :integer > > The patch in this ticket fixes the postgresql adapter to dump columns > with limits. > > 2) Also in postgresql, the above migration will generate a smallint > column, which uses 2 bytes for storage. I think it should generate an > integer column, so it can handle 3 bytes numbers without overflow -- > and this is also covered by the patch attached. > > 3) Finally, in mysql the migration will generate a INT(3) column, what > means a column with display size of 3, and not a column with 3 bytes > for storage. The patch changes mysql adapter to use the limit > constraint to generate smallint, mediumint, int and bigint columns > accordingly. > > > On 7/3/07, Michael Koziarski <michael@koziarski.com> wrote: > > > > > Can anyone check this ticket? > > > http://dev.rubyonrails.org/ticket/5489 > > > > > > It''s 1 year old already, but still valid imho. > > > > I don''t quite follow what the problem is with the current > > implementation? could you give me an example of what bugs / > > mis-behaviour this patch will prevent? > > > > > > -- > > Cheers > > > > Koz > > > > > > > > > > >-- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Pedro Mariano Belo
2007-Aug-02 01:39 UTC
Re: Wrong interpretation of limit in both Mysql and PostgreSQL adapters
ops, I''m back. well, sqlite doesn''t support :limit anyways, so I guess we should skip this test for adapters that doesn''t support it, correct? any ideas? On 7/6/07, Michael Koziarski <michael@koziarski.com> wrote:> > > Well, I was asked to include #5484 into this ticket, so it is dealing > > with distinct bugs at once. > > Sounds good. This patch breaks sqlite''s tests, if you can merge > those in, it seems good to apply. > > > > To understand those bugs, let''s begin with a single migration that > > creates a table with one column: > > t.column :limit3, :integer, :limit => 3 > > > > 1) When you run this migration under postgresql, the column is dumped > > to schema.rb without the limit: > > t.column "limit3", :integer > > > > The patch in this ticket fixes the postgresql adapter to dump columns > > with limits. > > > > 2) Also in postgresql, the above migration will generate a smallint > > column, which uses 2 bytes for storage. I think it should generate an > > integer column, so it can handle 3 bytes numbers without overflow -- > > and this is also covered by the patch attached. > > > > 3) Finally, in mysql the migration will generate a INT(3) column, what > > means a column with display size of 3, and not a column with 3 bytes > > for storage. The patch changes mysql adapter to use the limit > > constraint to generate smallint, mediumint, int and bigint columns > > accordingly. > > > > > > On 7/3/07, Michael Koziarski <michael@koziarski.com> wrote: > > > > > > > Can anyone check this ticket? > > > > http://dev.rubyonrails.org/ticket/5489 > > > > > > > > It''s 1 year old already, but still valid imho. > > > > > > I don''t quite follow what the problem is with the current > > > implementation? could you give me an example of what bugs / > > > mis-behaviour this patch will prevent? > > > > > > > > > -- > > > Cheers > > > > > > Koz > > > > > > > > > > > > > > > > > > > > -- > Cheers > > Koz > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Pedro Mariano Belo
2007-Dec-04 01:52 UTC
Re: Wrong interpretation of limit in both Mysql and PostgreSQL adapters
humm just reminded about this tarmo added sqlite tests. can anyone check and hopefully add? On Aug 1, 2007 5:39 PM, Pedro Mariano Belo <pedrobelo@gmail.com> wrote:> ops, I''m back. > > well, sqlite doesn''t support :limit anyways, so I guess we should skip > this test for adapters that doesn''t support it, correct? > > any ideas? > > > On 7/6/07, Michael Koziarski <michael@koziarski.com> wrote: > > > > > Well, I was asked to include #5484 into this ticket, so it is dealing > > > with distinct bugs at once. > > > > Sounds good. This patch breaks sqlite''s tests, if you can merge > > those in, it seems good to apply. > > > > > > > To understand those bugs, let''s begin with a single migration that > > > creates a table with one column: > > > t.column :limit3, :integer, :limit => 3 > > > > > > 1) When you run this migration under postgresql, the column is dumped > > > to schema.rb without the limit: > > > t.column "limit3", :integer > > > > > > The patch in this ticket fixes the postgresql adapter to dump columns > > > with limits. > > > > > > 2) Also in postgresql, the above migration will generate a smallint > > > column, which uses 2 bytes for storage. I think it should generate an > > > integer column, so it can handle 3 bytes numbers without overflow -- > > > and this is also covered by the patch attached. > > > > > > 3) Finally, in mysql the migration will generate a INT(3) column, what > > > means a column with display size of 3, and not a column with 3 bytes > > > for storage. The patch changes mysql adapter to use the limit > > > constraint to generate smallint, mediumint, int and bigint columns > > > accordingly. > > > > > > > > > On 7/3/07, Michael Koziarski <michael@koziarski.com> wrote: > > > > > > > > > Can anyone check this ticket? > > > > > http://dev.rubyonrails.org/ticket/5489 > > > > > > > > > > It''s 1 year old already, but still valid imho. > > > > > > > > I don''t quite follow what the problem is with the current > > > > implementation? could you give me an example of what bugs / > > > > mis-behaviour this patch will prevent? > > > > > > > > > > > > -- > > > > Cheers > > > > > > > > Koz > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > Cheers > > > > Koz > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Pedro Mariano Belo
2007-Dec-04 02:31 UTC
Re: Wrong interpretation of limit in both Mysql and PostgreSQL adapters
gee, no more sql files for creating test database structures? i''ll try to update the patch once again On Dec 3, 2007 5:52 PM, Pedro Mariano Belo <pedrobelo@gmail.com> wrote:> humm just reminded about this > > tarmo added sqlite tests. can anyone check and hopefully add? > > > On Aug 1, 2007 5:39 PM, Pedro Mariano Belo <pedrobelo@gmail.com> wrote: > > ops, I''m back. > > > > well, sqlite doesn''t support :limit anyways, so I guess we should skip > > this test for adapters that doesn''t support it, correct? > > > > any ideas? > > > > > > On 7/6/07, Michael Koziarski <michael@koziarski.com> wrote: > > > > > > > Well, I was asked to include #5484 into this ticket, so it is dealing > > > > with distinct bugs at once. > > > > > > Sounds good. This patch breaks sqlite''s tests, if you can merge > > > those in, it seems good to apply. > > > > > > > > > > To understand those bugs, let''s begin with a single migration that > > > > creates a table with one column: > > > > t.column :limit3, :integer, :limit => 3 > > > > > > > > 1) When you run this migration under postgresql, the column is dumped > > > > to schema.rb without the limit: > > > > t.column "limit3", :integer > > > > > > > > The patch in this ticket fixes the postgresql adapter to dump columns > > > > with limits. > > > > > > > > 2) Also in postgresql, the above migration will generate a smallint > > > > column, which uses 2 bytes for storage. I think it should generate an > > > > integer column, so it can handle 3 bytes numbers without overflow -- > > > > and this is also covered by the patch attached. > > > > > > > > 3) Finally, in mysql the migration will generate a INT(3) column, what > > > > means a column with display size of 3, and not a column with 3 bytes > > > > for storage. The patch changes mysql adapter to use the limit > > > > constraint to generate smallint, mediumint, int and bigint columns > > > > accordingly. > > > > > > > > > > > > On 7/3/07, Michael Koziarski <michael@koziarski.com> wrote: > > > > > > > > > > > Can anyone check this ticket? > > > > > > http://dev.rubyonrails.org/ticket/5489 > > > > > > > > > > > > It''s 1 year old already, but still valid imho. > > > > > > > > > > I don''t quite follow what the problem is with the current > > > > > implementation? could you give me an example of what bugs / > > > > > mis-behaviour this patch will prevent? > > > > > > > > > > > > > > > -- > > > > > Cheers > > > > > > > > > > Koz > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Cheers > > > > > > Koz > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Pedro Mariano Belo
2007-Dec-05 07:12 UTC
Re: Wrong interpretation of limit in both Mysql and PostgreSQL adapters
ok, patch updated against r8279 can anyone verify? On Dec 3, 2007 6:31 PM, Pedro Mariano Belo <pedrobelo@gmail.com> wrote:> gee, no more sql files for creating test database structures? > i''ll try to update the patch once again > > > On Dec 3, 2007 5:52 PM, Pedro Mariano Belo <pedrobelo@gmail.com> wrote: > > humm just reminded about this > > > > tarmo added sqlite tests. can anyone check and hopefully add? > > > > > > On Aug 1, 2007 5:39 PM, Pedro Mariano Belo <pedrobelo@gmail.com> wrote: > > > ops, I''m back. > > > > > > well, sqlite doesn''t support :limit anyways, so I guess we should skip > > > this test for adapters that doesn''t support it, correct? > > > > > > any ideas? > > > > > > > > > On 7/6/07, Michael Koziarski <michael@koziarski.com> wrote: > > > > > > > > > Well, I was asked to include #5484 into this ticket, so it is dealing > > > > > with distinct bugs at once. > > > > > > > > Sounds good. This patch breaks sqlite''s tests, if you can merge > > > > those in, it seems good to apply. > > > > > > > > > > > > > To understand those bugs, let''s begin with a single migration that > > > > > creates a table with one column: > > > > > t.column :limit3, :integer, :limit => 3 > > > > > > > > > > 1) When you run this migration under postgresql, the column is dumped > > > > > to schema.rb without the limit: > > > > > t.column "limit3", :integer > > > > > > > > > > The patch in this ticket fixes the postgresql adapter to dump columns > > > > > with limits. > > > > > > > > > > 2) Also in postgresql, the above migration will generate a smallint > > > > > column, which uses 2 bytes for storage. I think it should generate an > > > > > integer column, so it can handle 3 bytes numbers without overflow -- > > > > > and this is also covered by the patch attached. > > > > > > > > > > 3) Finally, in mysql the migration will generate a INT(3) column, what > > > > > means a column with display size of 3, and not a column with 3 bytes > > > > > for storage. The patch changes mysql adapter to use the limit > > > > > constraint to generate smallint, mediumint, int and bigint columns > > > > > accordingly. > > > > > > > > > > > > > > > On 7/3/07, Michael Koziarski <michael@koziarski.com> wrote: > > > > > > > > > > > > > Can anyone check this ticket? > > > > > > > http://dev.rubyonrails.org/ticket/5489 > > > > > > > > > > > > > > It''s 1 year old already, but still valid imho. > > > > > > > > > > > > I don''t quite follow what the problem is with the current > > > > > > implementation? could you give me an example of what bugs / > > > > > > mis-behaviour this patch will prevent? > > > > > > > > > > > > > > > > > > -- > > > > > > Cheers > > > > > > > > > > > > Koz > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > Cheers > > > > > > > > Koz > > > > > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---