Thread: Uncalled CREATE OR REPLACE VIEW in privileges dialog

Uncalled CREATE OR REPLACE VIEW in privileges dialog

From
Erwin Brandstetter
Date:
Hi developers!

My best wishes for 2011 to the pgAdmin team! :)

Testing v.1.12.2 (Dec 13 2010) on Windows XP Pro, Server PostgreSQL
8.4.5 on Debian Lenny.
I found some weirdness in the privileges dialog for VIEWs.

On changing any privileges via dialog, the VIEW itself gets CREATE OR
REPLACEd in addition. That's uncalled for.
As long as the used SQL is free of mistakes, this will probably go
unnoticed by most. It is still a waste of CPU cycles - and a problem
waiting to happen.
Reproducibly every time.
The matching dialog for TABLEs seems ok.
Problem is also present in v.1.10

I have created a track ticket accordingly:  #296
I skipped the e-mail to the list and just filed the ticket in trac with
a couple of issues recently as I did not feel the need for more details.
I hope that is acceptable protocol ...


Testcase:
~~~~~~~~
CREATE TABLE bar( id integer,  foo text);
CREATE VIEW v_test AS SELECT b.foo FROM bar b;

-- Now change any privileges via properties dialog. Check the Definition
and SQL tabs before and after making changes.
-- After revoking ALL from public, the SQL tab reads:
CREATE OR REPLACE VIEW v_test AS
SELECT b.foo
    FROM bar b;;        -- also note the two ";"! does not do anything,
but possibly points to weirdness in the source code!
REVOKE ALL ON TABLE v_test FROM public;


And that's what actually gets sent to the server, as the server log shows:
...
postgres LOG:  Anweisung: SELECT xmin FROM pg_class WHERE oid = 335878::oid
postgres LOG:  Anweisung: CREATE OR REPLACE VIEW v_test AS
    SELECT b.foo
       FROM bar b;;
    REVOKE ALL ON TABLE v_test FROM public;
...

Regards
Erwin

Re: Uncalled CREATE OR REPLACE VIEW in privileges dialog

From
Guillaume Lelarge
Date:
Hi Erwin,

Le 04/01/2011 21:24, Erwin Brandstetter a écrit :
> [...]
> My best wishes for 2011 to the pgAdmin team! :)
>

Best wishes for you too :)

> Testing v.1.12.2 (Dec 13 2010) on Windows XP Pro, Server PostgreSQL
> 8.4.5 on Debian Lenny.
> I found some weirdness in the privileges dialog for VIEWs.
>
> On changing any privileges via dialog, the VIEW itself gets CREATE OR
> REPLACEd in addition. That's uncalled for.
> As long as the used SQL is free of mistakes, this will probably go
> unnoticed by most. It is still a waste of CPU cycles - and a problem
> waiting to happen.
> Reproducibly every time.
> The matching dialog for TABLEs seems ok.
> Problem is also present in v.1.10
>
> I have created a track ticket accordingly:  #296
> I skipped the e-mail to the list and just filed the ticket in trac with
> a couple of issues recently as I did not feel the need for more details.
> I hope that is acceptable protocol ...
>

Sure. I would love to get such good report every time a user finds a bug :)

Anyway, found the issue, fixed it, and pushed the commits.

Thanks again.


--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com