Re: How to log bind values for statements that produce errors

2021-09-07 Thread Raul Kaubi
bind parameter from the second query (as I understood the developer). Regards Raul Kontakt Tom Lane () kirjutas kuupäeval T, 7. september 2021 kell 16:48: > Raul Kaubi writes: > > We have a problem with certain select statement, which produces error > and we would like to know th

How to log bind values for statements that produce errors

2021-09-07 Thread Raul Kaubi
H Centos7, postgres 13 We have a problem with certain select statement, which produces error and we would like to know the bind value that is given as parameter. At the moment, the column is bigint type, and probably the bind that goes there is text, in postgresql logfile, the error is

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Raul Kaubi
Ok, Thanks! Raul Kontakt Paul Förster () kirjutas kuupäeval R, 20. november 2020 kell 12:54: > Hi Raul, > > > On 20. Nov, 2020, at 11:45, Raul Kaubi wrote: > > > > Hmm, ok. > > > > But how is this possible..? > > > > when b.sender>0 and

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Raul Kaubi
Hmm, ok. But how is this possible..? when b.sender>0 and c.receiver>0 then > 'Primary+Replica' Raul Kontakt Paul Förster () kirjutas kuupäeval R, 20. november 2020 kell 12:04: > Hi Raul, > > > On 20. Nov, 2020, at 10:41, Raul Kaubi wrote: > > >

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Raul Kaubi
> > > On 20. Nov, 2020, at 10:03, Thomas Kellerer wrote: > > > > Raul Kaubi schrieb am 20.11.2020 um 09:53: > >> CentOS 7 > >> Postgres 9 to 12 > >> > >> For monitoring purpose, I would like that certain scripts are only run > in primary ser

Determine if postgresql cluster running is primary or not

2020-11-20 Thread Raul Kaubi
Hi CentOS 7 Postgres 9 to 12 For monitoring purpose, I would like that certain scripts are only run in primary server. So I am looking ways to universally discover if postgresql cluster that is running is primary or not. What would be the best way to achieve this? Regards Raul

Re: Parameter value from (mb/gb) to bytes

2020-11-19 Thread Raul Kaubi
Hi Thanks, you solution works for most of the databases. But now I noticed that we have single 9.5 version also. And seems like this function *pg_size_bytes* came from 9.6 # psql -U postgres -Atc "select > pg_size_bytes(current_setting('shared_buffers'));" > ERROR: function pg_size_bytes(text)

Discovering postgres binary directory location

2020-11-11 Thread Raul Kaubi
Hi CentOS 7 Postgres 9 to 12 I am looking ways to universally discover postgresql binary directory for monitoring purpose. For example postgres 12, it is: */usr/pgsql-12* So what would be the best way to discover this in specific host. Regards Raul

Re: Parameter value from (mb/gb) to bytes

2020-10-14 Thread Raul Kaubi
Hi Thanks for all the replies. So at first, I did this: select (pg_size_bytes(setting) * (select setting from pg_settings where name = 'block_size')::int) as shared_buffers from pg_settings where name = 'shared_buffers'; But as I understood, that the preferred way would be this, correct..? (at

Parameter value from (mb/gb) to bytes

2020-10-14 Thread Raul Kaubi
Hi Is there a simple way to dynamically get for example parameter "shared buffers" value (megabytes or gigabytes) to bytes, for monitoring perspective..? At the moment, this gives me value in GB. # psql -U postgres -Atc "show shared_buffers;" 1GB This value may as well be in MB. So I am

Re: Error handling: Resume work after error

2020-02-05 Thread Raul Kaubi
tas kuupäeval K, 5. veebruar 2020 kell 17:03: > On Wed, Feb 05, 2020 at 04:17:09PM +0200, Raul Kaubi wrote: > > Let's say I want my procedure/function to resume work after specific > error > > ( duplicate_table ). > > Is it possible to resume work after error..

Error handling: Resume work after error

2020-02-05 Thread Raul Kaubi
Hi PostgreSQL 12.1 Let's say I want my procedure/function to resume work after specific error ( duplicate_table ). Is it possible to resume work after error..? EXCEPTION > WHEN duplicate_table then ..; Or is there different approach to achieve that..? Thanks Raul

Re: Declare variable from other variable

2020-02-05 Thread Raul Kaubi
Makes sense yeah. Thanks for both of your help. Raul Kontakt hubert depesz lubaczewski () kirjutas kuupäeval K, 5. veebruar 2020 kell 14:50: > On Wed, Feb 05, 2020 at 02:42:42PM +0200, Raul Kaubi wrote: > > Thanks, it worked! > > > > By the way, what does this "**j&

Re: Declare variable from other variable

2020-02-05 Thread Raul Kaubi
v_to_date := (date_trunc('month',current_date)::date + interval '1 month' + interval '1 month'*j)::date; Raul Kontakt Yasin Sari () kirjutas kuupäeval K, 5. veebruar 2020 kell 14:28: > On Wed, Feb 5, 2020 at 2:22 PM Raul Kaubi wrote: > >> >> DO $$ >>> DECLARE >>

Re: Get rid of brackets around variable

2020-02-05 Thread Raul Kaubi
Awesome, thanks! Kontakt Geoff Winkless () kirjutas kuupäeval K, 5. veebruar 2020 kell 13:11: > > > On Wed, 5 Feb 2020 at 10:48, Raul Kaubi wrote: > >> >> DO $$ >>> DECLARE >>> cur cursor for >>> select * from (values('logi_web'), ('logi_tausta

Declare variable from other variable

2020-02-05 Thread Raul Kaubi
Hi PostgreSQL 12.1 How can I declare another variable from another variable. Basically from oracle, I can just: > var1 := 'asda'||var2; In postgres, I have the following example, I would like to use variable j to add number of months there. " interval 'j month')::date; " DO $$ > DECLARE >

Get rid of brackets around variable

2020-02-05 Thread Raul Kaubi
Hi PostgreSQL 12.1 I am trying to figure out, how can I get rid of brackets for variable. Example as follows: DO $$ > DECLARE > cur cursor for > select * from (values('logi_web'), ('logi_taustaprotsess')) as q (col1); > BEGIN > for i in cur LOOP > RAISE NOTICE 'create table %_y2020m01