Re: Restrict user to create only one db with a specific name

2020-03-06 Thread Paul Förster
Hi Tiff, from what you say, it sounds that each user should have his or her own database. Considering the other answers here already pointing out the difficulties, why don't you just create a database for each user with the same name as the username and grant him or her access to it. So,

Re: Restrict user to create only one db with a specific name

2020-03-06 Thread David G. Johnston
On Friday, March 6, 2020, David G. Johnston wrote: > On Fri, Mar 6, 2020 at 4:28 PM Tiffany Thang > wrote: > >> Hi, >> Is there a way in PostgreSQL 12 to restrict user to creating a database >> with a specific database name? >> >> > >> You could just have them log into an admin database and

Re: Restrict user to create only one db with a specific name

2020-03-06 Thread David G. Johnston
On Fri, Mar 6, 2020 at 4:28 PM Tiffany Thang wrote: > Hi, > Is there a way in PostgreSQL 12 to restrict user to creating a database > with a specific database name? > > For example, userA can only create a database with a name called mydb. Any > other names would generate an error. > > If that

Restrict user to create only one db with a specific name

2020-03-06 Thread Tiffany Thang
Hi, Is there a way in PostgreSQL 12 to restrict user to creating a database with a specific database name? For example, userA can only create a database with a name called mydb. Any other names would generate an error. If that is not possible, will it be possible then to limit userA to creating

Re: libpq and escaping array string literals

2020-03-06 Thread Dmitry Igrishin
Hey Ted, libpq has no such a facility. If you're on C++ you may want to use Pgfe library to work with the database arrays easy. On Fri, 6 Mar 2020, 22:11 Ted Toth, wrote: > I've got so C code that interacting with a table containing a field of > type text[]. Strings I've got to put in the

libpq and escaping array string literals

2020-03-06 Thread Ted Toth
I've got so C code that interacting with a table containing a field of type text[]. Strings I've got to put in the array may be unicode and or contain single or double quotes etc ... What's the best way to escape these strings? Ted

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

2020-03-06 Thread Andres Freund
Hi, On 2020-02-27 10:52:36 -0500, Tom Lane wrote: > 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 had any caffeine yet

Re: Real application clustering in postgres.

2020-03-06 Thread Jeremy Schneider
On 3/6/20 01:25, Ron wrote: > On 3/5/20 6:07 AM, Laurenz Albe wrote: >> 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

Re: Real application clustering in postgres.

2020-03-06 Thread Andrew Kerber
Yup, if you need true shared storage, Oracle RAC is still the only solution out there, All the other multi-master solutions work by capturing the sql statements themselves. And properly configured it RAC is indeed part of an HA solution. Any time you have everything in a single data center, as

Re: Real application clustering in postgres.

2020-03-06 Thread Ron
On 3/6/20 8:55 AM, Laurenz Albe wrote: On Fri, 2020-03-06 at 03:25 -0600, Ron wrote: RAC is not really a high availability solution: because of the shared storage, it has a sibgle point of failure. This is utter nonsense. Dual redundant storage controllers connected to disks in RAID-10

Re: Limit transaction lifetime

2020-03-06 Thread Fabio Ugo Venchiarutti
On 06/03/2020 16:14, Andrei Zhidenkov wrote: If it's a single command you're trying to limit `SET statement_timeout TO ` should do the trick. This will set only statement timeout but won’t work for long transactions that contain a lot of short statements. If you want it based on the

Re: Limit transaction lifetime

2020-03-06 Thread Andrei Zhidenkov
> If it's a single command you're trying to limit `SET statement_timeout TO > ` should do the trick. This will set only statement timeout but won’t work for long transactions that contain a lot of short statements. > If you want it based on the session's cumulative statement time, off the

Re: What do null column values for pg_stat_progress_vacuum mean?

2020-03-06 Thread Adrian Klaver
On 3/5/20 6: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 ]+--- datid| 16385 datname | database_name pid

Re: Real application clustering in postgres.

2020-03-06 Thread Ravi Krishna
> > If you have mirrored disks, and you write junk (e.g, because of > a flaw in a fibre channel cable, something I have witnessed), > then you have two perfectly fine copies of the junk. > Few years ago didn't this happen to Salesforce where a firmware bug corrupted the Disk, resulting in

Re: Limit transaction lifetime

2020-03-06 Thread Fabio Ugo Venchiarutti
On 06/03/2020 14:24, Andrei Zhidenkov wrote: Is there a way to limit a transaction lifetime in PostgreSQL? I could use `idle_in_transaction_session_timeout` parameter but it applies only to IDLE transactions. However, I want to rollback any transaction that executes more than specified

Re: How to allow users to create and modify tables only in their own schemas, but with generic table owner

2020-03-06 Thread Laurenz Albe
On Fri, 2020-03-06 at 11:04 +, Schmid Andreas wrote: > I'd like to setup my database in a way that only a superuser may create > schemas, > then grants permission to a specific user to create tables inside this schema. > This should work so far with GRANT CREATE ON SCHEMA ... TO user_a. >

Re: Real application clustering in postgres.

2020-03-06 Thread Laurenz Albe
On Fri, 2020-03-06 at 03:25 -0600, Ron wrote: > > RAC is not really a high availability solution: because of the shared > > storage, it has a sibgle point of failure. > > This is utter nonsense. Dual redundant storage controllers > connected to disks in RAID-10 configurations have been around

Limit transaction lifetime

2020-03-06 Thread Andrei Zhidenkov
Is there a way to limit a transaction lifetime in PostgreSQL? I could use `idle_in_transaction_session_timeout` parameter but it applies only to IDLE transactions. However, I want to rollback any transaction that executes more than specified period of time. -- With best regards, Andrei

geting results of query in plperl

2020-03-06 Thread stan
I have looked at: https://www.postgresql.org/docs/8.4/plperl-database.html I am also comfortable querying data from tables in perl. But I do not quite see how to get the results of a query in plperl. Here is what I tried, and it is not working: my $rv2 = spi_exec_query('SELECT current_user');

How to allow users to create and modify tables only in their own schemas, but with generic table owner

2020-03-06 Thread Schmid Andreas
Hi List I'd like to setup my database in a way that only a superuser may create schemas, then grants permission to a specific user to create tables inside this schema. This should work so far with GRANT CREATE ON SCHEMA ... TO user_a. However I want the table owner not to be the user that

Re: Real application clustering in postgres.

2020-03-06 Thread Ron
On 3/5/20 6:07 AM, Laurenz Albe wrote: 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

Re: Real application clustering in postgres.

2020-03-06 Thread Laurenz Albe
On Thu, 2020-03-05 at 17:06 +, Virendra Kumar wrote: > 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