# Pg\_dump Issue While Exporting Schema of Existing Postgres Database for YugaByte Migration

**URL:** <https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742>\
**Category:** General\
**Created:** [June 26, 2024, 2:38pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742 "2024-06-26T14:38:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![setu1421](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@setu1421](https://forum.yugabyte.com/u/setu1421)\
**Post date:** [June 26, 2024, 2:38pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742/1 "2024-06-26T14:38:40Z")

</div>

I have an existing postgres database which I want to migrate to YugaByte using [yb-voyager](https://docs.yugabyte.com/preview/yugabyte-voyager/migrate/migrate-steps/#prepare-the-target-database). 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](https://canada1.discourse-cdn.com/flex027/uploads/yugabyte/original/1X/2f7081c20c0bcee1bc703674783db45caa2eca0f.png)](https://i.sstatic.net/JfGTH3q2.png)

What should I do in this case?

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [June 26, 2024, 2:42pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742/2 "2024-06-26T14:42:44Z")

</div>

Hi @setu1421

Please paste errors as text.

---

<div class="post-metadata">

**Author:** ![setu1421](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@setu1421](https://forum.yugabyte.com/u/setu1421)\
**Post date:** [June 26, 2024, 3:02pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742/3 "2024-06-26T15:02:43Z")

</div>

@dorian_yugabyte, I have edited the post.

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [June 26, 2024, 3:04pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742/4 "2024-06-26T15:04:50Z")

</div>

Can you paste output of:

```auto
pg_dump --version

```

```auto
which pg_dump

```

---

<div class="post-metadata">

**Author:** ![setu1421](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@setu1421](https://forum.yugabyte.com/u/setu1421)\
**Post date:** [June 26, 2024, 3:12pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742/5 "2024-06-26T15:12:59Z")

</div>

> [@dorian\_yugabyte](#):
>
> `pg_dump --version`

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.

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [June 26, 2024, 3:16pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742/6 "2024-06-26T15:16:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![setu1421](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@setu1421](https://forum.yugabyte.com/u/setu1421)\
**Post date:** [June 26, 2024, 3:21pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742/7 "2024-06-26T15:21:31Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [June 26, 2024, 3:39pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742/8 "2024-06-26T15:39:54Z")

</div>

Try `sudo yum install postgresql-client-12.6` ?

---

<div class="post-metadata">

**Author:** ![setu1421](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@setu1421](https://forum.yugabyte.com/u/setu1421)\
**Post date:** [June 26, 2024, 3:40pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742/9 "2024-06-26T15:40:54Z")

</div>

> [@dorian\_yugabyte](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![setu1421](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@setu1421](https://forum.yugabyte.com/u/setu1421)\
**Post date:** [June 26, 2024, 6:42pm UTC](https://forum.yugabyte.com/t/pg-dump-issue-while-exporting-schema-of-existing-postgres-database-for-yugabyte-migration/2742/10 "2024-06-26T18:42:45Z")

</div>

I found that I have multiple version of pg\_dump installed.

![image](https://canada1.discourse-cdn.com/flex027/uploads/yugabyte/original/1X/aef386cc8388d86dcd8a717f4a15cc6f686d8c03.png)

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

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

```
