Re: What do null column values for pg_stat_progress_vacuum mean?

2020-03-05 Thread Mark Haylock
Sorry I've failed to mention which postgres version this is with: PostgreSQL 10.11. On Fri, Mar 6, 2020 at 3:39 PM Mark Haylock wrote: > > Hi, > > We have an autovacuum process that has been running for almost 27 hours: > > SELECT * FROM pg_stat_activity WHERE pid = 11731; > -[ RECORD 1 ]+---

What do null column values for pg_stat_progress_vacuum mean?

2020-03-05 Thread Mark Haylock
Hi, We have an autovacuum process that has been running for almost 27 hours: SELECT * FROM pg_stat_activity WHERE pid = 11731; -[ RECORD 1 ]+--- datid| 16385 datname | database_name pid | 11731 usesysid | usename

Table with many NULLS for indexed column yields strange query plan

2020-03-05 Thread greigwise
I have a query like this: SELECT "table1".* FROM "table1" INNER JOIN "table2" ON "table2"."table1_id" = "table1"."id" INNER JOIN "table3" ON "table3"."id" = "table2"."table3_id" WHERE "table3"."number" = '' AND ("table2"."type") IN ('Standard') ; table2 has a large number of NULLS in the col

Re: Advice request : simultaneous function/data updates on many databases

2020-03-05 Thread Rory Campbell-Lange
On 04/03/20, Rory Campbell-Lange (r...@campbell-lange.net) wrote: > We have many databases of the same type separated for data governance > reasons. They, however, share the same web front-end code. > > Presently, replacing functions and performing data updates on the > databases in series often e

Re: Getting a error on creating a partition table index 12.2.

2020-03-05 Thread Alvaro Herrera
On 2020-Mar-05, Adrian Klaver wrote: > The OP was wondering why it worked in 12.1 and not 12.2? > > I could not see any obvious reason for that, so: > > 1) There is a not obvious reason > > 2) It did not work in 12.1 either. (2) is correct. 55469 12.1 9913=# show server_version; server_versi

Re: Getting a error on creating a partition table index 12.2.

2020-03-05 Thread Adrian Klaver
On 3/5/20 11:31 AM, Alvaro Herrera wrote: On 2020-Mar-05, Adrian Klaver wrote: On 3/5/20 10:04 AM, nikhil raj wrote: *CREATE INDEX t_e20so1_doi_c_doid_idx     ON public.t_e20so1_doi USING btree     (i_doid ASC NULLS LAST)     TABLESPACE pg_default;* *ERROR: cannot specify default ta

Re: Getting a error on creating a partition table index 12.2.

2020-03-05 Thread Alvaro Herrera
On 2020-Mar-05, Adrian Klaver wrote: > On 3/5/20 10:04 AM, nikhil raj wrote: > > *CREATE INDEX t_e20so1_doi_c_doid_idx > >     ON public.t_e20so1_doi USING btree > >     (i_doid ASC NULLS LAST) > >     TABLESPACE pg_default;* > > *ERROR: cannot specify default tablespace for partitioned relat

Re: Getting a error on creating a partition table index 12.2.

2020-03-05 Thread nikhil raj
Ok, thanks for the clarification. On Fri, Mar 6, 2020 at 12:31 AM Adrian Klaver wrote: > On 3/5/20 10:48 AM, nikhil raj wrote: > > Hi Adrian, > > > > On that table nothing was happening just created the table and later o > > was creating the index and i was getting this error. > > > > Please can

Re: Getting a error on creating a partition table index 12.2.

2020-03-05 Thread Adrian Klaver
On 3/5/20 10:48 AM, nikhil raj wrote: Hi Adrian, On that table nothing was happening just created the table and later o was creating the index and i was getting this error. Please can you tell me is this the draw back of that in 12.2 version. Unfortunately I don't have answer for you on th

Re: Getting a error on creating a partition table index 12.2.

2020-03-05 Thread nikhil raj
Hi Adrian, On that table nothing was happening just created the table and later o was creating the index and i was getting this error. Please can you tell me is this the draw back of that in 12.2 version. On Fri, 6 Mar 2020, 12:04 am Adrian Klaver, wrote: > On 3/5/20 10:04 AM, nikhil raj wrote

Re: Getting a error on creating a partition table index 12.2.

2020-03-05 Thread Adrian Klaver
On 3/5/20 10:04 AM, nikhil raj wrote: HI ALL, While creating the index on the partition table i am getting error on it  saying *ERROR: cannot specify default tablespace for partitioned relations SQL state: 0A00.* Query is *CREATE INDEX t_e20so1_doi_c_doid_idx     ON public.t_e20so1_doi U

Re: A question about the number of times a trigger will fire

2020-03-05 Thread stan
On Thu, Mar 05, 2020 at 08:58:32AM -0700, David G. Johnston wrote: > On Thu, Mar 5, 2020 at 7:58 AM stan wrote: > > > UPDATE BOM_ITEM SET cost_per_unit = 23.45 , qty = 12345.00 > > > > So, it appears that I need to create a WHERE clause for the resultant > > statement. But I do not see how the f

Getting a error on creating a partition table index 12.2.

2020-03-05 Thread nikhil raj
HI ALL, While creating the index on the partition table i am getting error on it saying *ERROR: cannot specify default tablespace for partitioned relations SQL state: 0A00.* Query is * CREATE INDEX t_e20so1_doi_c_doid_idxON public.t_e20so1_doi USING btree(i_doid ASC NULLS LAST)TA

Re: Real application clustering in postgres.

2020-03-05 Thread Virendra Kumar
Failover is easy but failback is little bit tricky.I have implemented failback by doing following steps: 1. Start original primary which will be doing crash recovery. It should be designed in such a way that once it is up application should not start connecting to it otherwise there will be spli

RE: Real application clustering in postgres.

2020-03-05 Thread Daulat Ram
Thanks for your inputs Laurenz Albe. Would you please explain single-master failover solution. Suppose we have promoted standby (replica) as master after the h/w issue at Master. If after few hours we recovered the h/w then how we can switchback on the old primary. . As in Oracle we have s

Re: format return of "age" to hh:mm

2020-03-05 Thread Adrian Klaver
On 3/5/20 7:50 AM, David Gauthier wrote: Hi: How does one reformat the output of the "age" function to always be in terms of hours:mins. E.g. dvdb=> select age('2020-03-05 01:40:32-05','2020-03-01 21:56:05-05');        age -  3 days 03:44:27 (1 row) I want... "75:44" I'm

Re: format return of "age" to hh:mm

2020-03-05 Thread Ray O'Donnell
On 05/03/2020 15:50, David Gauthier wrote: > Hi: > > How does one reformat the output of the "age" function to always be in > terms of hours:mins. Hi there, age() returns an interval, so without having tried it I'm guessing you could use to_char() to format it whatever way you want. Ray. -- R

Re: format return of "age" to hh:mm

2020-03-05 Thread David G. Johnston
On Thu, Mar 5, 2020 at 8:50 AM David Gauthier wrote: > Hi: > > How does one reformat the output of the "age" function to always be in > terms of hours:mins. > > > Custom function. Use justify_hours(interval) to normalize the input in terms of days Use extract(field from interval) to get the comp

Re: format return of "age" to hh:mm

2020-03-05 Thread Andrei Zhidenkov
However, you cannot use to_char() to display the count of days for a given interval. In this case, if your interval is larger than 24 hours, you might use extract(epoch from ) and perform the conversion manually. > On 5. Mar 2020, at 17:07, Ray O'Donnell wrote: > > On 05/03/2020 15:50, David G

Re: pg_dump and public schema

2020-03-05 Thread Adrian Klaver
On 3/5/20 6:57 AM, Олег Самойлов wrote: Thanks. I expected that the database restored from its dump must be exactly the same. As it was before. But something in PostgresQL changes and not always for the good. From what I see: 1) pg_dump -C -U postgres -d sch_test CREATE DATABASE sch_test W

Re: A question about the number of times a trigger will fire

2020-03-05 Thread David G. Johnston
On Thu, Mar 5, 2020 at 7:58 AM stan wrote: > UPDATE BOM_ITEM SET cost_per_unit = 23.45 , qty = 12345.00 > > So, it appears that I need to create a WHERE clause for the resultant > statement. But I do not see how the function has enough data to use to > create this where clause. > > What am I mis

format return of "age" to hh:mm

2020-03-05 Thread David Gauthier
Hi: How does one reformat the output of the "age" function to always be in terms of hours:mins. E.g. dvdb=> select age('2020-03-05 01:40:32-05','2020-03-01 21:56:05-05'); age - 3 days 03:44:27 (1 row) I want... "75:44" I'm not married to "age" If there's a better way

RE: trouble making PG use my Perl

2020-03-05 Thread Kevin Brannen
From: Alan Hodgson On Mon, 2020-03-02 at 18:23 -0500, Tom Lane wrote: Kevin Brannen < Centos 8 ships with 5.14 (IIRC). I don't have an actual Centos 8 machine handy to disprove that, but the info I have says that RHEL8/Centos 8 branched off from Fedora 28, and F28 most definitely shipped

A question about the number of times a trigger will fire

2020-03-05 Thread stan
I am in the process of trying to set up a function.trigger pair to create functionally an updateable view. I would think that the trigger would fire the number of times that the calling statement's WHERE clause seceded. Is this incorrect> I have a view called purchase_view, one of the tables in

Re: pg_dump and public schema

2020-03-05 Thread Олег Самойлов
Thanks. I expected that the database restored from its dump must be exactly the same. As it was before. But something in PostgresQL changes and not always for the good. > 4 марта 2020 г., в 19:19, Adrian Klaver > написал(а): > > I believe this is the latest information on public schema handli

Re: Poor plan choice with partial unique indexes on jsonb column and simple RLS policy (with test script)

2020-03-05 Thread Alastair McKinley
Hi Tom, Thanks once again for your time looking at this. I have a resolution but didn't exactly get to the bottom of what was going on. Forcing the function used in the index to be leakproof did not work. I guessed, but am not certain, that this is because either to_jsonb() or jsonb_eq opera

Re: Real application clustering in postgres.

2020-03-05 Thread Laurenz Albe
On Thu, 2020-03-05 at 07:45 +, Daulat Ram wrote: > Is there any possibility/options to setup a real application clustering in > Postgres as in Oracle we have a RAC feature. No, and as far as I know nobody feels interested in providing it. RAC is a complicated architecture that doesn't do mu

Re: Determining the type of an obkect in plperl

2020-03-05 Thread Rob Sargent
> On Mar 5, 2020, at 4:22 AM, stan wrote: > > On Thu, Mar 05, 2020 at 12:27:12AM +, Ravi Krishna wrote: >> >>> >>> how can I determine what the data type of the value element is? >>> >> perl has a ref function which can tell what type of object. >> >> https://perldoc.perl.org/function

Re: Determining the type of an obkect in plperl

2020-03-05 Thread stan
On Thu, Mar 05, 2020 at 12:27:12AM +, Ravi Krishna wrote: > > > > > how can I determine what the data type of the value element is? > > > perl has a ref function which can tell what type of object. > > https://perldoc.perl.org/functions/ref.html > > > > > -- > This email has been checked

Re: Determining the type of an obkect in plperl

2020-03-05 Thread stan
On Thu, Mar 05, 2020 at 12:27:12AM +, Ravi Krishna wrote: > > > > > how can I determine what the data type of the value element is? > > > perl has a ref function which can tell what type of object. > > https://perldoc.perl.org/functions/ref.html > > > > That was my goto answer, but see

Re: Determining the type of an obkect in plperl

2020-03-05 Thread stan
On Wed, Mar 04, 2020 at 05:09:19PM -0700, David G. Johnston wrote: > On Wed, Mar 4, 2020 at 4:21 PM stan wrote: > > > Probably a bit off topic, but I suspect someone on this list knows how to > > do > > this. > > > > I am in the process of writing a plperl function. In this function I need > > to

Re: Advice request : simultaneous function/data updates on many databases

2020-03-05 Thread Alban Hertroys
> On 4 Mar 2020, at 23:42, Guyren Howe wrote: > > On Mar 4, 2020, at 14:33 , Rory Campbell-Lange > wrote: >> >> Essentially we wish to reduce the window where the frontend and backend >> aren't synchronised. >> >> If we have (for example) 200 databases which each take 2 seconds to >> update