Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default size of text column in Rails (PostgreSQL)

If I have this in a migration:

t.text :body

How much text can I fit in :body? (I'm using PostgreSQL if that's relevant)

like image 333
Tom Lehman Avatar asked Aug 26 '09 04:08

Tom Lehman


People also ask

What is the difference between varchar and text in PostgreSQL?

Difference Between PostgreSQL TEXT and VARCHAR Data Types The only difference between TEXT and VARCHAR(n) is that you can limit the maximum length of a VARCHAR column, for example, VARCHAR(255) does not allow inserting a string more than 255 characters long.

What is the difference between string and text in Rails?

As you are probably aware, both string and text save “string-type” information that you can freely write in. The difference between the two is how many characters you can put in these fields. A string field has a limit of 255 characters, whereas a text field has a character limit of 30,000 characters.

What is the size of text in Postgres?

3) PostgreSQL Text Data Type The PostgreSQL Text data type is used to keep the character of infinite length. And it can hold a string with a maximum length of 65,535 bytes.


1 Answers

straight from PostgreSQL Documentation

text    variable unlimited length

Meaning you can put any length of string in a text column when using PostgreSQL

like image 109
ez. Avatar answered Oct 06 '22 06:10

ez.