Re: libpq CREATE DATABASE operation from multiple treads

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: p(dot)sun(dot)fun(at)gmail(dot)com
Cc: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: libpq CREATE DATABASE operation from multiple treads
Date: 2020-10-08 20:36:09
Message-ID: 2624889.1602189369@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

p(dot)sun(dot)fun(at)gmail(dot)com writes:
> Indeed, this is a FATAL_ERROR. From two threads I got:
> // Thread #1
> FATAL_ERROR: ERROR: source database "template1" is being accessed by
> other users
> DETAIL: There is 1 other session using the database.

You'd be better off to connect to some other database than template1;
not only just for this purpose, but in general. If you are issuing
random commands in template1, there's a risk of modifying that database
unexpectedly and thereby changing the contents of databases created
in future.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message p.sun.fun 2020-10-08 20:41:01 Re: libpq CREATE DATABASE operation from multiple treads
Previous Message Rob Sargent 2020-10-08 20:35:16 Re: libpq CREATE DATABASE operation from multiple treads