Re: pg_restore - generated column - not populating

2021-02-22 Thread Adrian Klaver
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 ve

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 similar here >

Re: Simple IN vs IN values performace

2021-02-22 Thread Michael Lewis
> > Insert the values into a TEMPORARY TABLE, then join that to your main > table? > In my experience, this is very performant but needs an analyze command after populating the temp table to ensure there are statistics so the plan doesn't go awry. Otherwise, I'm not sure it is different from a mat

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 commands for d

Re: pg_restore - generated column - not populating

2021-02-22 Thread Santosh Udupi
I used the following commands for dump pg_dump -c mydb | gzip -9 > mydb.gz pg_dump -C -Fc mydb > mydb.backup pg_dump -Ft mydb > mydb.tar For restore, I created a blank database by issuing the command "createdb mydb" and then tried gunzip -c mydb.gz | psql mydb pg_restore -d mydb mydb.backup pg_r

Re: pg_restore - generated column - not populating

2021-02-22 Thread Adrian Klaver
On 2/22/21 5:08 PM, Santosh Udupi wrote: 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

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: Simple IN vs IN values performace

2021-02-22 Thread Ron
On 2/22/21 9:00 AM, Oleksandr Voytsekhovskyy wrote: Greetings, We have queries with IN filters with long list of INT values Sometimes, they running extremely slow, and I have found suggestion to use syntax Field IN (VALUES(1465), (1478), ... Instead of Field IN (1465, 1478, ... On some cases

Re: fdatasync performance problem with large number of DB files

2021-02-22 Thread Tom Lane
Michael Brown writes: > I presume the reason postgres doesn't blindly run a sync() is that we > don't know what other I/O is on the system and it'd be rude to affect > other services. That makes sense, except for our environment the work > done by the recursive fsync is orders of magnitude more di

Re: Simple IN vs IN values performace

2021-02-22 Thread Michael Lewis
Wouldn't using “= any(array)” change how the query is planned? Or is the concern just parsing the values?

Re: Migrate database to different versions

2021-02-22 Thread David G. Johnston
On Monday, February 22, 2021, Lorenzzo Egydio Mollinar da Cruz < loren...@iftm.edu.br> wrote: > I need to migrate a database from postgresql 9 to postgresql 12, as I will > update the version of my MOODLE and the current version does not support > postgres 9, is there any procedure for me to migra

Re: Simple IN vs IN values performace

2021-02-22 Thread David G. Johnston
On Monday, February 22, 2021, Oleksandr Voytsekhovskyy wrote: > What is the right way to pass long INT values list to IN filter > Don’t. Pass in a delimited string, then parse that string into an array and use “= any(array)”. This has the primary benefit of making the input a single parameter.

Migrate database to different versions

2021-02-22 Thread Lorenzzo Egydio Mollinar da Cruz
I need to migrate a database from postgresql 9 to postgresql 12, as I will update the version of my MOODLE and the current version does not support postgres 9, is there any procedure for me to migrate this database from 9 to version 12 of the database? Att. *Lorenzzo Egydio Mollinar da Cruz**CTIC

fdatasync performance problem with large number of DB files

2021-02-22 Thread Michael Brown
We've encountered a production performance problem with pg13 related to how it fsyncs the whole data directory in certain scenarios, related to what Paul (bcc'ed) described in a post to pgsql-hackers [1]. Background: We've observed the full recursive fsync is triggered when * pg_basebackup recei

Re: Re: Problem enabling LDAP login

2021-02-22 Thread Marcelo Lacerda
Thank you joão, that solved the problem!

Simple IN vs IN values performace

2021-02-22 Thread Oleksandr Voytsekhovskyy
Greetings, We have queries with IN filters with long list of INT values Sometimes, they running extremely slow, and I have found suggestion to use syntax Field IN (VALUES(1465), (1478), ... Instead of Field IN (1465, 1478, ... On some cases it helps, but on other it makes query running 1000+ ti

Re: JSONB_AGG: aggregate function calls cannot be nested

2021-02-22 Thread Alexander Farber
Ahh, thank you all - select row_to_json (x) FROM( SELECT jsonb_agg(day) AS day, jsonb_agg(completed) AS completed, jsonb_agg(expired) AS expired from ( SELECT TO_CHAR(finished, '-MM-DD') AS day, count(*) filter (where reason in ('regular', 'resigned'))

Re: Streaming replication between different OS

2021-02-22 Thread Peter J. Holzer
On 2021-02-22 23:02:12 +0530, Atul Kumar wrote: > As I am new to postgres, could you help me to in how to check collation show LC_COLLATE; > and what is de_DE locale ? The locale (i.e. language specific rules (sorting, formatting of numbers, dates, etc.) for German ("de") as spoken in Germany ("

Re: Streaming replication between different OS

2021-02-22 Thread Atul Kumar
Hi Tom, As I am new to postgres, could you help me to in how to check collation and what is de_DE locale ? Regards On Monday, February 22, 2021, Tom Lane wrote: > Ganesh Korde writes: > > On Mon, 22 Feb 2021, 11:48 am Atul Kumar, wrote: > >> I have postgres 9.6 cluster running on Cento

Re: Streaming replication between different OS

2021-02-22 Thread Peter J. Holzer
On 2021-02-22 10:36:56 -0500, Tom Lane wrote: > The other thing you have to worry about is whether the collations you > use sort the same on both systems ... if they don't, you'll have > effectively-corrupt indexes on text columns on the standby. > > According to > > https://wiki.postgresql.org/w

Re: Streaming replication between different OS

2021-02-22 Thread Tom Lane
Ganesh Korde writes: > On Mon, 22 Feb 2021, 11:48 am Atul Kumar, wrote: >> I have postgres 9.6 cluster running on Centos 6.8, so I just wanted to >> know that can I configure streaming replication with same postgres version >> i.e 9.6 running on centos 7. > Should not be a problem if both OS arc

Re: Problem enabling LDAP login

2021-02-22 Thread João Gaspar
Hi, Marcelo checks this I have a similar problem with the LDAP filter in pg_hba.conf. I don't know if helps in your case. In my case, I needed to add the OU (Organizational Unit) https://www.postgresql.org/message-id/CAM%2BzXj0b71fckDSTxPwX58ze-9mtD4UxbktzGCmUYAnjoZti3A%40mail.gmail.com Best re

cannot promote after recovery for PITR

2021-02-22 Thread Luca Ferrari
I'm running 12.5, I've restored a backup copy (from barman) to a specific restore point. The system has gone into pause, and I've checked that everything is as I was expecting. Now I'm unable to promote the cluster: testdb=# SELECT pg_is_wal_replay_paused(); pg_is_wal_replay_paused --

Re: JSONB_AGG: aggregate function calls cannot be nested

2021-02-22 Thread David G. Johnston
On Monday, February 22, 2021, Alexander Farber wrote: > > > but how to get a JSON map of lists here? I am trying: > > { >"day": [ "2021-02-08", "2021-02-09", ... ], >"completed": [ 475, 770, ...], >"expired": [ 155, 263 , ...] > } > If you want the days aggregated then don’t “group b

Re: JSONB_AGG: aggregate function calls cannot be nested

2021-02-22 Thread Alexander Farber
Thank you Thomas, this results in select day AS day, jsonb_agg(completed) AS completed, jsonb_agg(expired) AS expired from ( SELECT TO_CHAR(finished, '-MM-DD') AS day, count(*) filter (where reason in ('regular', 'resigned')) AS completed, count

Problem enabling LDAP login

2021-02-22 Thread Marcelo Lacerda
I'm having some trouble configuring ldap login to postgres. I have configured LDAP on pg_hba.conf and postgres picks up the correct configuration during login but I get an error message whenever I attempt to login with psql to a database named teste. psql: error: could not connect to server: FATAL

Re: Streaming replication between different OS

2021-02-22 Thread Ganesh Korde
Should not be a problem if both OS archtecture (32 bit/ 64 bit) are same. On Mon, 22 Feb 2021, 11:48 am Atul Kumar, wrote: > Hi, > > > I have postgres 9.6 cluster running on Centos 6.8, so I just wanted to > know that can I configure streaming replication with same postgres version > i.e 9.6 run