Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm migrating my app from MySQL to Postgres. If I do a rake db:schema:load, it loads fine into Postgres, and all my tests pass.

If I do rake db:migrate:reset, then an integer column that I had previously set to have :limit => 1 is set to have :limit => 2.

My migration sets it like so:

t.integer "foo", :limit => 1, :null => false

Is it simply a matter of Postgres having a lower minimum size?

share|improve this question

2 Answers

up vote 1 down vote accepted

The smallint type in PostgreSQL occupies two byte and accepts numbers from -32768 to +32767.

There is no tinyint like in MySQL that occupies 1 byte and accepts numbers from -128 to 127.

share|improve this answer

Postgres doesn't provide a 1-byte integer type. The smallest datatype for integer is the 2-byte smallint.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.