Recursive CTEs and randomness - is there something I'm missing?

2020-02-27 Thread Pól Ua Laoínecháin
Hi all, I'm trying to generate a series of random strings (capital A-Z) between 2 and 5 characters long (say, 10^6). I'm using a recursive CTE to achieve this. A fiddle is available here: https://dbfiddle.uk/?rdbms=postgres_12&fiddle=206a0c522e853f043c7e633d19852de2 The SQL: WITH RECURSIVE r

Re: Need to find the no. of connections for a database

2020-02-27 Thread Rob Sargent
On 2/27/20 10:38 PM, rob stone wrote: If the menu is built from a table in your database, then when "Processing report" starts you could set a flag (boolean) against those items so that if anybody tried to log-in or access those items, you could simply display a message along the lines of "Pro

Re: Need to find the no. of connections for a database

2020-02-27 Thread rob stone
Hello, On Fri, 2020-02-28 at 01:10 +, sivapostg...@yahoo.com wrote: > Then clearly I've misunderstood what advisory lock could do. We > used to put locks in SQL server to avoid deadlock situations. I > thought advisory lock is a similar one. [ New to Postgres ] > > The report is arrived

Re: table name "unnest" specified more than once

2020-02-27 Thread David G. Johnston
On Thursday, February 27, 2020, Guyren Howe wrote: > # select > * > from > unnest(array[array['a', 'b'], array['c', 'c']]), > unnest(array[array['1', '2'], array['3', '4']]); > ERROR: 42712: table name "unnest" specified more than once > This specific error is resolved by using the alias featu

table name "unnest" specified more than once

2020-02-27 Thread Guyren Howe
# select * from unnest(array[array['a', 'b'], array['c', 'c']]), unnest(array[array['1', '2'], array['3', '4']]); ERROR: 42712: table name "unnest" specified more than once I’m trying to cross-join multiple two-dimensional arrays, expecting to retain the inner arrays. I’ve be

Re: Need to find the no. of connections for a database

2020-02-27 Thread sivapostg...@yahoo.com
Then clearly I've misunderstood what advisory lock could do.   We used to put locks in SQL server to avoid deadlock situations.  I thought advisory lock is a similar one.   [ New to Postgres ] The report is arrived from around 10 tables out of 300 tables that are in the database.  Once we start

Re: A question relative to creating an audit table

2020-02-27 Thread Vik Fearing
On 27/02/2020 22:28, stan wrote: > I ma considering setting up a function, and triggers to put a record in an > audit table when certain tables are altered. I pretty much think I know how > to do this, with one exception. There are extensions out there that deal with this for you. Here is one: ht

Re: pg_upgrade custom table locations. Move table locations during upgrade?

2020-02-27 Thread Tory M Blue
Finally found it http://bajis-postgres.blogspot.com/2014/04/anyone-wants-to-change-tablespaces.html Thanks Tory On Thu, Feb 27, 2020 at 12:40 PM Tory M Blue wrote: > Many decades ago (small fib). > > There was a write up of someone stopping the postgres upgrade at a certain > point, editing a

Re: A question relative to creating an audit table

2020-02-27 Thread Adrian Klaver
On 2/27/20 1:28 PM, stan wrote: I ma considering setting up a function, and triggers to put a record in an audit table when certain tables are altered. I pretty much think I know how to do this, with one exception. Can a function, called by a trigger, determine what table it was called for? A

Re: A question relative to creating an audit table

2020-02-27 Thread Andrei Zhidenkov
Why not to pass TG_TABLE_SCHEMA and TG_TABLE_NAME in its arguments? > On 27. Feb 2020, at 22:28, stan wrote: > > I ma considering setting up a function, and triggers to put a record in an > audit table when certain tables are altered. I pretty much think I know how > to do this, with one excepti

A question relative to creating an audit table

2020-02-27 Thread stan
I ma considering setting up a function, and triggers to put a record in an audit table when certain tables are altered. I pretty much think I know how to do this, with one exception. Can a function, called by a trigger, determine what table it was called for? -- "They that would give up essentia

RE: trouble making PG use my Perl

2020-02-27 Thread Kevin Brannen
From: Tom Lane >Kevin Brannen writes: >> The issue is that I've not been able to make Pg use our Perl (in >> /opt/perl) instead of the system one (in /usr). > >plperl.so will typically have a more or less hard-coded path to libperl.so, eg > >$ ldd ...installdir.../lib/plperl.so >linux-vd

pg_upgrade custom table locations. Move table locations during upgrade?

2020-02-27 Thread Tory M Blue
Many decades ago (small fib). There was a write up of someone stopping the postgres upgrade at a certain point, editing a file with the table locations and then restarting the upgrade process. "Now, what are you trying to do?" I have version specific directories (good for you), but... /pgsql/9.

Re: Is it safe to rename an index through pg_class update?

2020-02-27 Thread Tom Lane
Kouber Saparev writes: > На чт, 27.02.2020 г. в 17:52 Tom Lane написа: >> FWIW, I can't immediately think of a reason this would cause a problem, >> at least not on 9.4 and up which use MVCC catalog scans. If you're >> really still on 9.3 then it's notably more risky. In any case, I've >> not h

Re: trouble making PG use my Perl

2020-02-27 Thread Tom Lane
Kevin Brannen writes: > The issue is that I've not been able to make Pg use our Perl (in > /opt/perl) instead of the system one (in /usr). plperl.so will typically have a more or less hard-coded path to libperl.so, eg $ ldd ...installdir.../lib/plperl.so linux-vdso.so.1 => (0x7ffc6

trouble making PG use my Perl

2020-02-27 Thread Kevin Brannen
We're trying to upgrade our Pg 9.6 installs up to 12.2. In a break from tradition where we grab source and compile our own, I've downloaded the community RPMs for Centos 6 and installed them (they default into /usr/pgsql-12 it seems). I can make Pg come up, initdb, that sort of stuff just fine.

Re: Postgres 12.1 : UPPER() in WHERE clause restarts server

2020-02-27 Thread Tom Lane
Marc writes: > To whom do we report our findings regarding this issue ? EDB is already on it: https://www.postgresql.org/message-id/CA%2BOCxoz0bWi%2BR2WpocfkD20Lgrg69z1jQ_SZd-zmdzHW0zt%2Bbg%40mail.gmail.com regards, tom lane

Statistics and Index Usage Data

2020-02-27 Thread Casey Meijer
Hello all: I’m curious if there are any ways to query custom/extended multivariate statistics usage? I tried a few web searches, but can’t find anything there or in the docs. I imagine this simply isn’t implemented (is it expensive to keep this data?), but just wanted to double check. Also,

Re: Postgres 12.1 : UPPER() in WHERE clause restarts server

2020-02-27 Thread Adrian Klaver
On 2/27/20 9:08 AM, Marc wrote: Hello Tom, To whom do we report our findings regarding this issue ? Since it is an EDB hack I would try the contact form at the bottom of the this page: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads I can offer you a Belgian waffle t

Re: Postgres 12.1 : UPPER() in WHERE clause restarts server

2020-02-27 Thread Marc
Hello Tom, To whom do we report our findings regarding this issue ? I can offer you a Belgian waffle to go with you caffeine. Kindest Regards, Marc On 25 Feb 2020, at 10:35, Nick Renders wrote: Hi Tom, 1. we used the EDB installer. 2. turning JIT off did make the problem go away. So I

Re: Need to find the no. of connections for a database

2020-02-27 Thread Ireneusz Pluta/wp.pl
W dniu 2020-02-27 o 15:26, sivapostg...@yahoo.com pisze: Need to lock around 10 tables.  Let me try with pg_advisory_lock(). I am not sure why you mention table locks at this point. Just in case: with advisory locks you lock an "application flow", not database objects. On Thursday, 27 Feb

Re: Is it safe to rename an index through pg_class update?

2020-02-27 Thread Kouber Saparev
На чт, 27.02.2020 г. в 17:52 Tom Lane написа: > There's a lot of stuff like that that you can probably get away with... > but I'm not sure it's prudent to try it on valuable production data. > If it breaks your database nobody is going to have any sympathy for you. > > FWIW, I can't immediately t

Re: Is it safe to rename an index through pg_class update?

2020-02-27 Thread Tom Lane
Kouber Saparev writes: > Renaming an index the classical way through "ALTER INDEX xxx RENAME TO yyy" > needs an AccessExclusiveLock over the table holding the index (at least on > 9.3 it does). Instead, couldn't I simply: > UPDATE pg_class SET relname = 'yyy' WHERE oid = 'xxx'::regclass; There's

Re: Error “cache lookup failed for function”

2020-02-27 Thread Adrian Klaver
On 2/26/20 11:37 AM, Albrecht Dreß wrote: Sorry for the late reply, I've been on a short vacation… Am 21.02.20 21:44 schrieb(en) Adrian Klaver: 1) From your original post what does the below mean?: -- add several db functions One trigger function, plus two “normal” ones, all (yet) unused.

Re: unexpected behavior with pglogical -- bug?

2020-02-27 Thread Iban Rodriguez
Exactly same situation here. If I LISTEN for notifications, no notification is sent by subscriber when changes are received from replication. However, any local change makes all pending notifications be sent in addition to the corresponding to the local change. I have tested it on Postgres 12.1 E

Is it safe to rename an index through pg_class update?

2020-02-27 Thread Kouber Saparev
Hello everybody, Renaming an index the classical way through "ALTER INDEX xxx RENAME TO yyy" needs an AccessExclusiveLock over the table holding the index (at least on 9.3 it does). Instead, couldn't I simply: UPDATE pg_class SET relname = 'yyy' WHERE oid = 'xxx'::regclass; Are there any risks t

Re: Need to find the no. of connections for a database

2020-02-27 Thread sivapostg...@yahoo.com
Need to lock around 10 tables.  Let me try with pg_advisory_lock(). On Thursday, 27 February, 2020, 07:39:13 pm IST, Ireneusz Pluta/wp.pl wrote: W dniu 2020-02-27 o 14:37, sivapostg...@yahoo.com pisze: > Hello, > > I'm saying isolation will not work out to my requirement.   The steps.

Re: Need to find the no. of connections for a database

2020-02-27 Thread Ireneusz Pluta/wp.pl
W dniu 2020-02-27 o 14:37, sivapostg...@yahoo.com pisze: Hello, I'm saying isolation will not work out to my requirement.   The steps. 1.  On completion of all entries by all,  say for a day. 2.  Lock, so that no one enters any other data. 3.  Create a report from the entered data. 4.  Create /

Re: Need to find the no. of connections for a database

2020-02-27 Thread sivapostg...@yahoo.com
Hello, I'm saying isolation will not work out to my requirement.   The steps. 1.  On completion of all entries by all,  say for a day.2.  Lock, so that no one enters any other data.3.  Create a report from the entered data.4.  Create / Modify required entries from the values arrived in the repor

Re: Need to find the no. of connections for a database

2020-02-27 Thread Ireneusz Pluta/wp.pl
W dniu 2020-02-27 o 12:35, sivapostg...@yahoo.com pisze: I need to prevent other users from entering any transaction till I finish taking reports from my application.  All users will be using the same application, from which this report is supposed to be printed. maybe advisory lock is what y

Re: Need to find the no. of connections for a database

2020-02-27 Thread Ravi Krishna
"If they enter any data, those data also need to be taken into account in this report. " Pls read on PG's MVCC architecture. In SQLServer, unless you enabled its bad implementation of Snapshot isolation, you can't achieve the same. So it makes sense there. In PG it is easy to ensure that you

Re: Need to find the no. of connections for a database

2020-02-27 Thread sivapostg...@yahoo.com
Well, I need to prevent other users from entering any transaction till I finish taking reports from my application.  All users will be using the same application, from which this report is supposed to be printed.   If they enter any data, those data also need to be taken into account in this re

Re: Need to find the no. of connections for a database

2020-02-27 Thread Ravi Krishna
> > Before taking a few reports, we need to ensure that only one connection is > made to the database and all other computers need to close the connection to > that database. This is to prevent any additional entry(ies) that could be > made during the course of the report taking. This single

Re: Need to find the no. of connections for a database

2020-02-27 Thread Peter J. Holzer
On 2020-02-27 07:41:36 +, sivapostg...@yahoo.com wrote: > Before taking a few reports, we need to ensure that only one connection is > made > to the database and all other computers need to close the connection to that > database. This is to prevent any additional entry(ies) that could be ma

Re: How to install check_postgres on CentOS 8?

2020-02-27 Thread Peter J. Holzer
On 2020-02-26 15:11:38 +0100, rai...@ultra-secure.de wrote: > I'm trying to install the check_postgres RPM from the official > postgresql.org repository onto CentOS 8.1 > > It says: > > Error: > Problem: cannot install the best candidate for the job > - nothing provides perl-DateTime-Format-Da