pg_restore - generated column - not populating

2021-02-22 Thread Santosh Udupi
Hi all, My database has tables with generated columns. I altered a table and added a generated column as below: alter table billing add primary_bill_to_id int GENERATED ALWAYS as ((info->>'vp')::int) stored Now, when I do the pg_dump and pg_restore, this column does not get populated. It rema

Re: pg_restore - generated column - not populating

2021-02-22 Thread Santosh Udupi
-d mydb mydb.backup pg_restore -Ft -d mydb mydb.backup I have tried -c, -C, schema only etc but nothing has worked so far. I didn't check the Postgres logs. Thanks for the suggestion. I will check that. On Mon, Feb 22, 2021 at 5:16 PM Adrian Klaver wrote: > On 2/22/21 5:08 PM, Sant

Re: pg_restore - generated column - not populating

2021-02-22 Thread Santosh Udupi
The logs don't show errors. I came across something similar here https://www.postgresql-archive.org/Dumping-restoring-fails-on-inherited-generated-column-td6114378.html but not sure what the solution is. On Mon, Feb 22, 2021 at 5:57 PM Santosh Udupi wrote: > I used the following comm

Re: pg_restore - generated column - not populating

2021-02-22 Thread Santosh Udupi
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 On Mon, Feb 22, 2021 at 6:20 PM Santosh Udupi wrote: > The logs don't show errors. I came across something simi

Re: pg_restore - generated column - not populating

2021-02-23 Thread Santosh Udupi
n Mon, Feb 22, 2021 at 9:23 PM Adrian Klaver 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 colum

Re: pg_restore - generated column - not populating

2021-02-23 Thread Santosh Udupi
Got it. Must be the version difference. I run pgAdmin on Windows PC but direct pg_dump on Ubuntu 20.04. On Tue, Feb 23, 2021 at 7:27 AM Adrian Klaver wrote: > On 2/23/21 6:36 AM, Santosh Udupi wrote: > > The pg_restore command is actually pg_restore -Ft -d mydb mydb.tar (my &g

Re: pg_restore - generated column - not populating

2021-02-23 Thread Santosh Udupi
tabase but does not populate the generated columns. Strange!! On Tue, Feb 23, 2021 at 7:50 AM Adrian Klaver wrote: > On 2/23/21 7:39 AM, Santosh Udupi wrote: > > Got it. Must be the version difference. I run pgAdmin on Windows PC but > > direct pg_dump on Ubuntu 20.04. > >

Re: pg_restore - generated column - not populating

2021-02-23 Thread Santosh Udupi
lly on Ubuntu : pg_restore -d mydb-restore mydb.backup2 On Tue, Feb 23, 2021 at 9:34 AM Tom Lane wrote: > Santosh Udupi writes: > > Right. pg_dump under the pgAdmin runtime folder works perfectly. pg_dump > > in postgres13 (ubuntu) does not work. Exact same syntax. > &

Re: pg_restore - generated column - not populating

2021-02-23 Thread Santosh Udupi
ain_partition_2021 partition of tbl_main for values from ('2020-01-01') to ('2022-01-01'); create table tbl_main_partition_2022 partition of tbl_main for values from ('2022-01-01') to ('2023-01-01'); create table tbl_main_partition_2023 partition of tbl_main for

Re: pg_restore - generated column - not populating

2021-02-23 Thread Santosh Udupi
So that it makes it a lot easier for the application logic just to collect json fields and update in one column "info" instead of including multiple columns in the insert/update statements. On Tue, Feb 23, 2021 at 12:20 PM Adrian Klaver wrote: > On 2/23/21 12:15 PM, Santos

Re: pg_restore - generated column - not populating

2021-02-23 Thread Santosh Udupi
destination server and then do the pg_restore on the server. On Tue, Feb 23, 2021 at 3:21 PM Adrian Klaver wrote: > On 2/23/21 12:57 PM, Santosh Udupi wrote: > > So that it makes it a lot easier for the application logic just to > > collect json fields and update in one column "info&q

Re: pg_restore - generated column - not populating

2021-02-23 Thread Santosh Udupi
Sure. I will try that. On Tue, Feb 23, 2021 at 4:42 PM Adrian Klaver wrote: > On 2/23/21 4:25 PM, Santosh Udupi wrote: > > Yes, this is what we have been doing now:- Backup using pg_dump, create > > the new database at the destination, manually create the tables which > &g