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