Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-12 Thread Kevin Grittner
On Mon, Sep 12, 2016 at 8:14 AM, Kevin Grittner wrote: > On Mon, Sep 12, 2016 at 7:55 AM, Tom Lane wrote: >> The query you committed is flat wrong, because it doesn't >> account for database ownership being granted via role membership. > > Ah, there was a flaw in my testing script. It appeared

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-12 Thread Kevin Grittner
On Mon, Sep 12, 2016 at 7:55 AM, Tom Lane wrote: > Kevin Grittner writes: >> But that gives incorrect results for the case I asked about earlier >> on the thread, while the query I pushed gives correct results: > > AFAICS, my query gives correct results for that case. bob is permitted > to copy

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-12 Thread Tom Lane
Kevin Grittner writes: > But that gives incorrect results for the case I asked about earlier > on the thread, while the query I pushed gives correct results: AFAICS, my query gives correct results for that case. bob is permitted to copy fred's databases db1 and postgres, or would be if he had cr

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-12 Thread Vitaly Burovoy
On 9/12/16, Kevin Grittner wrote: > On Sun, Sep 11, 2016 at 8:07 PM, Tom Lane wrote: > >> I wasn't aware that this patch was doing anything nontrivial ... > > Well, it is not doing anything other than showing candidate > templates for tab completion beyond those flagged as template > databases. >

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-12 Thread Kevin Grittner
On Sun, Sep 11, 2016 at 8:07 PM, Tom Lane wrote: > I wasn't aware that this patch was doing anything nontrivial ... Well, it is not doing anything other than showing candidate templates for tab completion beyond those flagged as template databases. > After looking at it I think it's basically u

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-11 Thread Vitaly Burovoy
On 9/11/16, Tom Lane wrote: > Vitaly Burovoy writes: >> On 9/11/16, Kevin Grittner wrote: >>> I was able to find cases during test which were not handled >>> correctly with either version, so I tweaked the query a little. > >> Hmm. Which one? Attempt to "SET ROLE "? >> Unfortunately, I after rea

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-11 Thread Tom Lane
Vitaly Burovoy writes: > On 9/11/16, Kevin Grittner wrote: >> I was able to find cases during test which were not handled >> correctly with either version, so I tweaked the query a little. > Hmm. Which one? Attempt to "SET ROLE "? > Unfortunately, I after reading your letter I realized that I mi

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-11 Thread Vitaly Burovoy
On 9/11/16, Kevin Grittner wrote: > On Sat, Sep 10, 2016 at 12:26 AM, Vitaly Burovoy >> Mark it as "Ready for committer". >> >> P.S.: While I was reviewing I simplified SQL query: improved version >> only 2 seqscans instead of 3 seqscans with an inner loop in an >> original one. >> Please find a f

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-11 Thread Kevin Grittner
On Sat, Sep 10, 2016 at 12:26 AM, Vitaly Burovoy wrote: > Tested manually in versions 9.2 and 10devel, I hope it can be > back-patched to all supported versions. We don't normally back-patch tab completion work unless it is fixing a crash or removing displayed entries which make no sense. This i

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-11 Thread Tom Lane
Kevin Grittner writes: > test=# create role fred with createdb; > CREATE ROLE > test=# create user bob; > CREATE ROLE > test=# grant fred to bob; > GRANT ROLE > test=# alter database postgres owner to fred; > ALTER DATABASE > test=# set role fred; > SET > test=> create database db1 template postgr

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-11 Thread Kevin Grittner
On Sat, Sep 10, 2016 at 12:26 AM, Vitaly Burovoy wrote: > According to the documentation since 9.2 till devel a database can be > used as a template if it has a "datistemplate" mark or by superusers > or by their owners. Hm. I wonder whether the following failure of "bob" to use the specified t

Re: [HACKERS][REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...

2016-09-09 Thread Vitaly Burovoy
Hello Sehrope Sarkuni, I have reviewed the patch. It is very simple (only an SQL query in the "psql" application changed). It applies at the top of master. It implements completion database names ("") for commands like "CREATE DATABASE ... TEMPLATE ". According to the documentation since 9.2 till