Migrating from MySQL to PostgreSQL

Encounter some issue along the way

1.MySQL DATE_SUB & DATE_ADD

(DATE_ADD(NOW(), INTERVAL 30 MINUTES)

(DATE_SUB(NOW(), INTERVAL 30 MINUTES)

(NOW() – INTERVAL ’30’ MINUTE)

(NOW() – INTERVAL ’30’ MINUTE) or

(NOW() – INTERVAL ’30 MINUTES’) or

(NOW() – ’30 MINUTES’::INTERVAL)

2. MySQL RADIANS

Need to cast to real

SELECT RADIANS(lat::real);

3. DISTINCT on json field (v9.4.5)


SELECT DISTINCT id, json_field FROM driver;

Throw could not identify an equality operator for type json error.
Converting the json field to jsonb solve the problem

Advertisements

Published by

paragasu

Different. In a good way

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s