Re: [REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...
От | Tom Lane |
---|---|
Тема | Re: [REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ... |
Дата | |
Msg-id | 7849.1473642453@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ... (Vitaly Burovoy <vitaly.burovoy@gmail.com>) |
Ответы |
Re: [REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...
Re: [REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ... |
Список | pgsql-hackers |
Vitaly Burovoy <vitaly.burovoy@gmail.com> writes: > On 9/11/16, Kevin Grittner <kgrittn@gmail.com> 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 <grouprole>"? > Unfortunately, I after reading your letter I realized that I missed a > case (it is not working even with your version): I wasn't aware that this patch was doing anything nontrivial ... After looking at it I think it's basically uninformed about how to test for ownership. An explicit join against pg_roles is almost never the right way for SQL queries to do that. Lose the join and write it more like this: +"SELECT pg_catalog.quote_ident(d.datname) "\ +" FROM pg_catalog.pg_database d "\ +" WHERE substring(pg_catalog.quote_ident(d.datname),1,%d)='%s' "\ +" AND (d.datistemplate OR pg_catalog.pg_has_role(d.datdba, 'USAGE'))" See the information_schema views for precedent. regards, tom lane
В списке pgsql-hackers по дате отправления: