0

I'm trying to migrate some data from postgres to mysql. for that i'm doing a simple sql in postgres and load it to mysql. since format is a bit different the flag -AF $'\t' in psql makes it tab delimiter which is great.

The missing part is that psql return null as empty string. where in mysql it represent as \N. Is there a flag that manage it? I would really like to avoid putting ifnull around each column in the select.

asked May 9, 2021 at 20:12
2
  • Are you building your own SQL statements to export a table as a complete INSERT? Commented May 9, 2021 at 21:18
  • something like that. I read an input and load it directly to the mysql target. NULLs are treated as empty strings for now and i'm looking to fix that. Commented May 10, 2021 at 7:14

1 Answer 1

2

psql has a flag that controls the way null is outputted -P 'null=\N'

answered May 10, 2021 at 8:03

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.