Switching from MySQL to PostgreSQL – tips, tricks and gotchas?

Just went through this myself, well I still am… Case sensitive text Lack of INSERT IGNORE and REPLACE Explicit casting needed almost everywhere No backticks LOAD DATA INFILE (COPY is close, but not close enough) Change autoincrement to SERIAL Although bad form in MySQL, in Postgres, an INNER JOIN without an ON clause can’t happen, … Read more

mysqldump table without dumping the primary key

To solve this problem, I looked up this question, found @pumpkinthehead’s answer, and realized that all we need to do is find+replace the primary key in each row with the NULL so that mysql will use the default auto_increment value instead. (your complete mysqldump command) | sed -e “s/([0-9]*,/(NULL,/gi” > my_dump_with_no_primary_keys.sql Original output: INSERT INTO … Read more

MySQL LOAD DATA INFILE with ON DUPLICATE KEY UPDATE

These steps can be used to emulate this functionality: Create a new temporary table. CREATE TEMPORARY TABLE temporary_table LIKE target_table; Optionally, drop all indices from the temporary table to speed things up. SHOW INDEX FROM temporary_table; DROP INDEX `PRIMARY` ON temporary_table; DROP INDEX `some_other_index` ON temporary_table; Load the CSV into the temporary table LOAD DATA … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)