Pg_dump Issue While Exporting Schema of Existing Postgres Database for YugaByte Migration

I have an existing postgres database which I want to migrate to YugaByte using yb-voyager. I used the below command to export the postgres database schema.

yb-voyager export schema --export-dir <EXPORT_DIR> \
        --source-db-type <SOURCE_DB_TYPE> \
        --source-db-host <SOURCE_DB_HOST> \
        --source-db-user <SOURCE_DB_USER> \
        --source-db-password <SOURCE_DB_PASSWORD> \
        --source-db-name <SOURCE_DB_NAME> \
        --source-db-schema <SOURCE_DB_SCHEMA>

However, I get below error with pg_dump.

export of schema for source type as ‘postgresql’
postgresql version: 12.16
migrationID: 3d981ffb-9239-4377-90d4-a25385e77f18
exporting the schema /could not get absolute path of pg_dump command: could not find pg_dump with version greater than or equal to map[pg_dump:14.0 pg_restore:14.0 psql:9.0]

enter image description here

What should I do in this case?

1 Like

Hi @setu1421

Please paste errors as text.

@dorian_yugabyte, I have edited the post.

Can you paste output of:

pg_dump --version
which pg_dump

pg_dump --version:

pg_dump: /usr/pgsql-14/lib/libpq.so.5: no version information available (required by pg_dump)
pg_dump (PostgreSQL) 10.23

which pg_dump:

/usr/bin/pg_dump

This is the output from the machine where I am running yb-voyager. My source database is present in another EC2 machine.

You need a newer pg_dump since looks like your database is on 12.6 and the pg_dump is on 10.23.

@dorian_yugabyte, Which version of pg_dump I need to install? Can I separately install newer version of pg_dump since it won’t be possible to upgrade the postgresql? I am assuming I should run like below to match pg_dump with postgresql?

sudo yum install postgresql12.6

Try sudo yum install postgresql-client-12.6 ?

It says:

No match for argument: postgresql-client-12.6
Error: Unable to find a match: postgresql-client-12.6

My machine is RHEL version 8. It’s an EC2 machine.

I found that I have multiple version of pg_dump installed.

image

So, I linked the newer version using the below command:

sudo ln -sfn /usr/pgsql-14/bin/pg_dump /usr/bin/pg_dump