Forum: Ruby on Rails Session id length in sessions table

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joshua P. (Guest)
on 2009-05-05 11:43
(Received via mailing list)
Dear all,

I just created session with rake db:sessions:create and run the
migration
also. When I run my apps, my db barfed out saying that the length of
session_id is too long. When I checked into my db, the length of
session_id
column in the sessions table, it was 255 of character varying. I then
changed it to 500 character varying and it works. But that would be too
long. Does anybody know the exact length of this field?

Thank you in advance.

--
If you can't believe in God the chances are your God is too small.

Read my blog: http://joshuajava.wordpress.com/
Follow us on twitter: http://twitter.com/scrum8
pepe (Guest)
on 2009-05-05 20:55
(Received via mailing list)
Hi there,

Not a DB expert but as far as I understand when you have a "varying"
field you are telling the DB how long the data in the field/column
**could be**. If you put a value that is shorter than the maximum
possible length the DB should arrange the storage for as much data as
you put in the field and no more, so 'extra empty space' is not
wasted. In other words, I think you should be fine, especially if you
clean up session information as sessions expire.

Pepe
Frederick C. (Guest)
on 2009-05-05 21:06
(Received via mailing list)
On May 5, 8:42 am, Joshua P. <removed_email_address@domain.invalid> wrote:
> Dear all,
>
> I just created session with rake db:sessions:create and run the migration
> also. When I run my apps, my db barfed out saying that the length of
> session_id is too long. When I checked into my db, the length of session_id
> column in the sessions table, it was 255 of character varying. I then
> changed it to 500 character varying and it works. But that would be too
> long. Does anybody know the exact length of this field?
>

It's not normally anywhere near that long. if you  are moving from an
app that was using the cookiestore session storage then you'll need to
clear out the sessions (because with the cookie store the session id
is the session data)

Fred
This topic is locked and can not be replied to.