The pg_restore command is actually
pg_restore -Ft -d mydb mydb.tar (my mistake).
I didn't provide the -h -p -U since I use the super user account to restore (I will try adding them). The restore had always worked until I altered the table in the source database.
After I added the column, the restore still takes place but does not populate the generated column. I did a backup using pgAdmin and the restore populated all data using the same syntax on the tar file. So my suspicion is that pg_dump is not doing the dump correctly. I will work on it further. Thanks for your suggestions.
On Mon, Feb 22, 2021 at 9:23 PM Adrian Klaver <adrian.klaver@xxxxxxxxxxx> wrote:
On 2/22/21 7:43 PM, Santosh Udupi wrote:
> If I backup using pgAdmin, I am able to restore using pg_restore but for
> some reason, pg_rsestore on the output from pg_dump does not create
> values for the generated columns
>
To troubleshoot this:
1) Stick to one dump/restore combination. The three versions you tried
before just confuse the issue. For instance:
pg_dump -Ft mydb > mydb.tar
pg_restore -Ft -d mydb mydb.backup
makes no sense. As mydb.backup came from:
pg_dump -C -Fc mydb > mydb.backup
I have not tested, but I'm pretty sure the pg_restore just ignored the
-Ft and just did -Fc.
2) Big explicit in your dump and restore commands for -h(ost), -p(ort)
and -U(ser). I suspect you may not be restoring to where you think you are.
3) Closely follow the progress of both the dump and the restore.
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx