Re: moving from MySQL to pgsql

From: Darren Duncan <darren(at)darrenduncan(dot)net>
To: Vineet Deodhar <vineet(dot)deodhar(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: moving from MySQL to pgsql
Date: 2012-10-11 00:17:15
Message-ID: 5076100B.4030006@darrenduncan.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gavin Flower 2012-10-11 00:47:14 Re: Index only scan
Previous Message Ondrej Ivanič 2012-10-10 23:56:27 Re: moving from MySQL to pgsql