Thread: Notices for redundant operations

Notices for redundant operations

From
Peter Eisentraut
Date:
I found a few notices and warnings that inform you that the command you
are executing has no effect because the object is already in the state you
want it.  I think these are useless, and there is also some inconsistency.
Does someone want to defend keeping them?

=> alter table test set without oids;
NOTICE:  table "test" is already WITHOUT OIDS

=> alter table test cluster on test_ix;
NOTICE:  table "test" is already being clustered on index "test_ix"

=> alter domain foo set not null;
NOTICE:  "foo" is already set to NOT NULL
[no such notice for altering a column, btw.]

=> listen foo;
WARNING:  already listening on "foo"

=> alter group test add user peter;
WARNING:  user "peter" is already in group "test"
[The SQL analogue with roles does not call for a completion condition in
this case.]

-- 
Peter Eisentraut   peter_e@gmx.net



Re: Notices for redundant operations

From
Alvaro Herrera
Date:
On Sat, Sep 06, 2003 at 12:47:21AM +0200, Peter Eisentraut wrote:
> I found a few notices and warnings that inform you that the command you
> are executing has no effect because the object is already in the state you
> want it.  I think these are useless, and there is also some inconsistency.
> Does someone want to defend keeping them?

If people doesn't receive any message regarding the command they
executed, they will execute it again, and again, and they will
eventually wonder what's wrong and start investigating why "nothing is
happening".

Warnings should be converted to notices, IMHO.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The problem with the future is that it keeps turning into the present"
(Hobbes)


Re: Notices for redundant operations

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> writes:
> I found a few notices and warnings that inform you that the command you
> are executing has no effect because the object is already in the state you
> want it.  I think these are useless, and there is also some inconsistency.
> Does someone want to defend keeping them?

Do you think the commands should just silently do nothing?  That seems
strange to me.  I like giving a NOTICE (not WARNING though, those guys
should be changed).

I guess the best argument for putting out a notice is that there's some
chance the user is making a mistake, eg, telling you SET NOT NULL when
what he really wanted to do was DROP NOT NULL.  If that argument doesn't
impress people then I suppose being silent is the thing to do.
        regards, tom lane


Re: Notices for redundant operations

From
Peter Eisentraut
Date:
Alvaro Herrera writes:

> If people doesn't receive any message regarding the command they
> executed, they will execute it again, and again, and they will
> eventually wonder what's wrong and start investigating why "nothing is
> happening".

That is not the case here.  The commands still generate the normal
response, e.g., "ALTER TABLE", if they succeed.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: Notices for redundant operations

From
"Mendola Gaetano"
Date:
"Tom Lane" <tgl@sss.pgh.pa.us> wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
> > I found a few notices and warnings that inform you that the command you
> > are executing has no effect because the object is already in the state
you
> > want it.  I think these are useless, and there is also some
inconsistency.
> > Does someone want to defend keeping them?
>
> Do you think the commands should just silently do nothing?  That seems
> strange to me.  I like giving a NOTICE (not WARNING though, those guys
> should be changed).

Of course not but I personally prefer have back a normal response.

Regards
Gaetano Mendola





Re: Notices for redundant operations

From
Robert Treat
Date:
On Saturday 06 September 2003 07:25, Peter Eisentraut wrote:
> Alvaro Herrera writes:
> > If people doesn't receive any message regarding the command they
> > executed, they will execute it again, and again, and they will
> > eventually wonder what's wrong and start investigating why "nothing is
> > happening".
>
> That is not the case here.  The commands still generate the normal
> response, e.g., "ALTER TABLE", if they succeed.

Hmm... the counter state seems to be that now these commands would tell you 
they are doing something even though they are arn't really doing anything:

=> alter table test set without oids;
ALTER TABLE
=> alter table test set without oids;
ALTER TABLE
=> alter table test set without oids;
ALTER TABLE

I think popping a notice that the table is already without oids could be 
helpful. for sure these types of messages should not be warnings though.

Robert Treat
-- 
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


Re: Notices for redundant operations

From
Peter Eisentraut
Date:
Robert Treat writes:

> Hmm... the counter state seems to be that now these commands would tell you
> they are doing something even though they are arn't really doing anything:

Commands are defined in terms of their results, not in terms of their
actions, and certainly not in terms of the amount of grinding that is
caused by them.

Have you ever realized that

GRANT SELECT ON table1 TO person;

might not do anything?  No one has suggested notices for that.  Or have
you ever seen a notice issued as the result of

chmod a+x filename

when the file was already executable?

-- 
Peter Eisentraut   peter_e@gmx.net



Re: Notices for redundant operations

From
Alvaro Herrera
Date:
On Sun, Sep 07, 2003 at 06:36:47PM +0200, Peter Eisentraut wrote:
> Robert Treat writes:
> 
> > Hmm... the counter state seems to be that now these commands would tell you
> > they are doing something even though they are arn't really doing anything:
> 
> Commands are defined in terms of their results, not in terms of their
> actions, and certainly not in terms of the amount of grinding that is
> caused by them.

This argument makes sense.  At least it convinced me.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La fuerza no está en los medios físicos
sino que reside en una voluntad indomable" (Gandhi)


Re: Notices for redundant operations

From
Peter Eisentraut
Date:
I wrote:

> I found a few notices and warnings that inform you that the command you
> are executing has no effect because the object is already in the state you
> want it.  I think these are useless, and there is also some inconsistency.
> Does someone want to defend keeping them?

I take it that people have grown to agree that these notices aren't really
useful.  So this is the last call before they'll disappear.

-- 
Peter Eisentraut   peter_e@gmx.net