Re: dblink: could not send query: another command is already in progress

2018-04-03 Thread Laurenz Albe
Thiemo Kellner wrote: > > The other thing is that you seem to call "dblink_get_result" on any existing > > connection before use. But you can only call the function if there is a > > result outstanding. > > I call dblink_get_result only if I do not open a dblink connection, i. > e. only on secon

Re: dblink: could not send query: another command is already in progress

2018-04-03 Thread Thiemo Kellner
On 04/03/18 11:28, Laurenz Albe wrote: [...] psql:testing/test.pg_sql:42: ERROR: function WRITE_MESSAGE_TO_TABLE(i_function => text, i_message => text, i_level => text, i_present_user => name, i_session_user => name, i_transaction_timestamp => timestamp with time zone, i_transaction_id => bigi

LDAP Bind Password

2018-04-03 Thread Kumar, Virendra
Hi There, Is anybody aware of how to encrypt bind password for ldap authentication in pg_hba.conf. Anonymous bind is disabled in our organization so we have to use bind ID and password but to keep them as plaintext in pg_hba.conf defeat security purposes. We want to either encrypt it or authent

Re: single sql, multiple schemas, one result set

2018-04-03 Thread Rob Sargent
On 04/03/2018 11:47 AM, PegoraroF10 wrote: Suppose a DB with dozens of schemas with same structure. DB Schema1 Table1 Table2 Schema2 Table1 Table2 Schema3 Table1 Table2 Then we want to execute a SQL on specific schemas and the result of it could be a UNION

Re: single sql, multiple schemas, one result set

2018-04-03 Thread Guyren Howe
Make a view that joins all the things, with a column providing the name of the schema that they came from. > On Apr 3, 2018, at 10:47 , PegoraroF10 wrote: > > Suppose a DB with dozens of schemas with same structure. > DB > Schema1 >Table1 >Table2 > Schema2 >Table1 >Table2 > S

single sql, multiple schemas, one result set

2018-04-03 Thread PegoraroF10
Suppose a DB with dozens of schemas with same structure. DB Schema1 Table1 Table2 Schema2 Table1 Table2 Schema3 Table1 Table2 Then we want to execute a SQL on specific schemas and the result of it could be a UNION ALL. So, how could be a function that runs that SQL on

Re: How to get an inclusive interval when using daterange

2018-04-03 Thread Paul Jungwirth
On 04/03/2018 09:40 AM, hmidi slim wrote: I tried insert into availability values ('product x', '[2018-02-02,2018-03-01]'::daterange); and I got the same result such as insert into availability values ('product x', daterange('2018-02-02', '2018-03-01', '[]'). Yes, those are equivalent ways of

Re: How to get an inclusive interval when using daterange

2018-04-03 Thread hmidi slim
HI, I tried* insert into availability values ('product x', '[2018-02-02,2018-03-01]'::daterange); *and I got the same result such as* insert into availability values ('product x', daterange('2018-02-02', '2018-03-01', '[]').*

Re: is pg_advisory_lock() suitable for long runs

2018-04-03 Thread Merlin Moncure
On Sat, Mar 31, 2018 at 1:49 PM, Radoslav Nedyalkov wrote: > Hi all, > it's very simple and intuitive case but let me describe first. > 1. session 1 calls pg_advisory_lock(1234) and succeeds. > 2. session 2 calls pg_advisory_lock(1234) and stops on waiting. > All fine BUT pid for session2 appears

Re: Seems like there is an issue with reltuples showing twice the number of rows

2018-04-03 Thread Ranjith Ramachandra
List, OP here. Thank you for replying. Confirms my diagnosis that it might have to do with analyze vaccum. Some debug info. 1. Loaded a CSV to fill the table with data. 2. performed analyse vacuum on this table after uploading. 3. I do not see any reason for dead rows because I have not updated

Re: How to get an inclusive interval when using daterange

2018-04-03 Thread Adrian Klaver
On 04/03/2018 07:35 AM, hmidi slim wrote: I tried it and I got the same result. Tried what? -- Adrian Klaver adrian.kla...@aklaver.com

Re: How to get an inclusive interval when using daterange

2018-04-03 Thread hmidi slim
I tried it and I got the same result.

Re: Seems like there is an issue with reltuples showing twice the number of rows

2018-04-03 Thread Tom Lane
Tomas Vondra writes: > On 04/03/2018 11:14 AM, Ranjith Ramachandra wrote: >> it returns >>  reltuples  | n_live_tup | n_dead_tup >> -++ >> 2.7209e+06 |    1360448 |    1360448 >> >> If I run analyze main_csv_0f247511f5c247c8813ba3cec90c6ae1_yf34fbb38d >> and I

Re: How to install pgTAP on cenos machine

2018-04-03 Thread Adrian Klaver
On 04/03/2018 02:34 AM, Raghavendra Rao J S V wrote: Hi, How to install pgTAP on Centos machine.? I tried to install but no luck. What did you do to install and where did it fail? Please guide me to proceed further. -- Regards, Raghavendra Rao J S V -- Adrian Klaver adrian.kla...@aklave

Re: Seems like there is an issue with reltuples showing twice the number of rows

2018-04-03 Thread Tomas Vondra
On 04/03/2018 11:14 AM, Ranjith Ramachandra wrote: > I am relying on reltuples on my web app to get fast row counts. > > This was recommended by this article to get fast approx row > counts: https://wiki.postgresql.org/wiki/Count_estimate > > > However for some table I am getting twice as many v

Re: Autovacuum Problem

2018-04-03 Thread Vitaliy Garnashevich
However no space seems to be freed to the system. Is there any way a bloody newbie can debug this behaviour? In our experience, autovacuum is able to contain bloating of table data, but not bloating of indexes. You could see where the bloating is by running the following queries: CREATE EX

How to install pgTAP on cenos machine

2018-04-03 Thread Raghavendra Rao J S V
Hi, How to install pgTAP on Centos machine.? I tried to install but no luck. Please guide me to proceed further. -- Regards, Raghavendra Rao J S V

Re: dblink: could not send query: another command is already in progress

2018-04-03 Thread Laurenz Albe
Thiemo Kellner wrote: > On 03/30/18 11:14, Laurenz Albe wrote: > > You have to consume the result before you can send the next query. > > I changed implementation but still get the same error but now different > context. I tried to retrieve the result but I failed > > I committed the last code t

Seems like there is an issue with reltuples showing twice the number of rows

2018-04-03 Thread Ranjith Ramachandra
I am relying on reltuples on my web app to get fast row counts. This was recommended by this article to get fast approx row counts: https://wiki.postgresql.org/wiki/Count_estimate However for some table I am getting twice as many values when I try to do this. I did some more research and came up

Re: Autovacuum Problem

2018-04-03 Thread Achilleas Mantzios
On 03/04/2018 10:54, Kein Name wrote: > Why would you want that? Do you have any control over the application? Any "special" patterns used in the app? Drive is running full :/ Sadly I have no control and knowledge whatsoever over/about the application. I tuned the autovacuum parameters now for

Re: Autovacuum Problem

2018-04-03 Thread Kein Name
> Why would you want that? Do you have any control over the application? Any "special" patterns used in the app? Drive is running full :/ Sadly I have no control and knowledge whatsoever over/about the application. I tuned the autovacuum parameters now for the critical tables, to have it run more

Re: Autovacuum Problem

2018-04-03 Thread Achilleas Mantzios
On 03/04/2018 10:00, Kein Name wrote: > VACUUM <> VACUUM FULL > Normally running VACUUM via autovacuum should help reuse free space but not actually return it to the filesystem / OS (unless it happens to be the last blocks in the data file(s)). > Ppl in normal/average type of installations/work

Re: Autovacuum Problem

2018-04-03 Thread Kein Name
> VACUUM <> VACUUM FULL > Normally running VACUUM via autovacuum should help reuse free space but not actually return it to the filesystem / OS (unless it happens to be the last blocks in the data file(s)). > Ppl in normal/average type of installations/workloads no longer (since 8.2) run VACUUM (or

Concatenate of values in hierarchical data

2018-04-03 Thread Mr. Baseball 34
I have the data below, returned from a PostgreSQL table using this SQL: SELECT ila.treelevel, ila.app, ila.lrflag, ila.ic, ila.price, ila.treelevel-1 as parent, ila.seq FROM indexlistapp ila WHERE ila.indexlistid IN (SEL