Notices for redundant operations

Started by Peter Eisentrautover 22 years ago9 messages
#1Peter Eisentraut
peter_e@gmx.net

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

#2Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Peter Eisentraut (#1)
Re: Notices for redundant operations

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)

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#1)
Re: Notices for redundant operations

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

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Alvaro Herrera (#2)
Re: Notices for redundant operations

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

#5Mendola Gaetano
mendola@bigfoot.com
In reply to: Peter Eisentraut (#1)
Re: Notices for redundant operations

"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

#6Robert Treat
xzilla@users.sourceforge.net
In reply to: Peter Eisentraut (#4)
Re: Notices for redundant operations

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

#7Peter Eisentraut
peter_e@gmx.net
In reply to: Robert Treat (#6)
Re: Notices for redundant operations

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

#8Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Peter Eisentraut (#7)
Re: Notices for redundant operations

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)

#9Peter Eisentraut
peter_e@gmx.net
In reply to: Peter Eisentraut (#1)
Re: Notices for redundant operations

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