Re: Likely bug in executing pgScript on wrong database

Поиск
Список
Период
Сортировка
От Guillaume Lelarge
Тема Re: Likely bug in executing pgScript on wrong database
Дата
Msg-id 1330507648.2696.6.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Likely bug in executing pgScript on wrong database  (Charles Gutjahr <charlesg@ourcommunity.com.au>)
Список pgadmin-support
On Wed, 2012-02-29 at 11:22 +1100, Charles Gutjahr wrote:
> I've found what appears to be a bug in the way pgAdmin III executes pgScript, which can cause it to run scripts on
thewrong database. I couldn't find any records of the bug in your Trac site, so I'm reporting it here.
 
> 
> Here's how to reproduce. In this example, assume I have two databases called 'one' and 'two' on a PostgreSQL server:
> 
>  *   Open pgAdmin III
>  *   Connect to a server and click on database 'one' in the object browser
>  *   Click the SQL button in the toolbar to open a query window
>  *   Click the dropdown at the top of the query window, choose <new connection>
>  *   Choose database 'two' and click OK to connect
>  *   The query window (and dropdown) now shows that I am connected to database 'two'
>  *   Write some SQL in the query window and execute it -- it executes on database 'two'
>  *   Write some pgScript SQL in the query window and execute it -- it executes on database 'one'
> 
> In other words, it seems that pgScript is executed on the original connection that existed when the query window was
opened,not the current connection that you have selected later. The problem occurs regardless of whether the
connectionsare to the same server or different servers. As you might imagine, this caused some confusion and heartache
herefor us!
 
> 
> A simple way to test this is to use the current_database() function in your SQL like this:
> 
>    -- SQL
>    select current_database();
> 
>    -- pgScript
>    declare @db;
>    set @db = select current_database();
>    print @db;
> 
> You should find that they return different results if you've followed the steps above.
> 

Yes, it's definitely a bug. I fixed it a few minutes ago.

Thanks for your report.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



В списке pgadmin-support по дате отправления:

Предыдущее
От: Dave Page
Дата:
Сообщение: Re: PG 9.1 Windows 7 64-bit pgAdmin says all pgAgent jobs fail
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: feature request - show role members