Re: moving from MySQL to pgsql - Mailing list pgsql-general

From Darren Duncan
Subject Re: moving from MySQL to pgsql
Date
Msg-id 5076100B.4030006@darrenduncan.net
Whole thread Raw
In response to moving from MySQL to pgsql  (Vineet Deodhar <vineet.deodhar@gmail.com>)
List pgsql-general
I noticed something here that none of the other replies addressed.

Vineet Deodhar wrote:
> 3) Can I simulate MySQL's TINYINT data-type (using maybe the custom data
> type or something else)

The answer to your question depends on what you were using the TINYINT for.

For example, many people use TINYINT in MySQL to store BOOLEAN (true/false) data
because MySQL doesn't have a real BOOLEAN type; MySQL has the BOOLEAN keyword,
but if you choose it then what you actually get is a TINYINT.

And so, if you are actually using the field just for true/false or 1/0 values,
then Postgres' BOOLEAN type (which is not a number) is the best thing for you to
use.

If you were storing actual numbers outside that range, then use SMALLINT or
something like that.

Any reverse engineering of the MySQL schema will never know you used the BOOLEAN
keyword and just say you have a TINYINT, so you may have to study your schema
and its uses more to know what kind of data/type you actually have.

-- Darren Duncan


pgsql-general by date:

Previous
From: Ondrej Ivanič
Date:
Subject: Re: moving from MySQL to pgsql
Next
From: Gavin Flower
Date:
Subject: Re: Index only scan