Re: Error messages/logging (Was: Re: [HACKERS] Re: [COMMITTERS] 'pgsql/src/backend/parser gram.y parse_oper.c')

Started by Peter T Mountabout 28 years ago11 messages
#1Peter T Mount
psqlhack@maidast.demon.co.uk

On Sat, 3 Jan 1998, Bruce Momjian wrote:

Sounds maybe a little too serious. We currently use WARN a lot to
indicate errors in the supplied SQL statement. Perhaps we need to make
the parser elog's ERROR, and the non-parser WARN's ABORT? Is that good?
When can I make the change? I don't want to mess up people's current work.

This shouldn't affect JDBC. The only thing that would break things, is if
the notification sent by the "show datestyle" statement is changed.

--
Peter T Mount petermount@earthling.net or pmount@maidast.demon.co.uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk

#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Peter T Mount (#1)

Mattias Kregert wrote:

Bruce Momjian wrote:

I just think the WARN word coming up on users terminals is odd. I can
make the change in all the source files easily if we decide what the new
error word should be. Error? Failure?

Yes, that's one of the things I don't understand with PostgreSQL.
ERROR would be much better.

How about ABORT ?

So I assume no one has pending patches where this change would cause a
problem. So I will go ahead.

--
Bruce Momjian
maillist@candle.pha.pa.us

#3Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Bruce Momjian (#2)

ABORT means that transaction is ABORTed.
Will ERROR mean something else ?
Why should we use two different flag-words for the same thing ?
Note, that I don't object against using ERROR, but against using two words.

I wanted two words to distinguish between user errors like a mis-spelled
field name, and internal errors like btree failure messages.

Make sense?

I made all the error messages coming from the parser as ERROR, and
non-parser messages as ABORT. I think I will need to fine-tune the
messages because I am sure I missed some messages that should be ERROR
but are ABORT. For example, utils/adt messages about improper data
formats, is that an ERROR or an ABORT?

--
Bruce Momjian
maillist@candle.pha.pa.us

#4Vadim B. Mikheev
vadim@sable.krasnoyarsk.su
In reply to: Bruce Momjian (#3)

Bruce Momjian wrote:

Mattias Kregert wrote:

Bruce Momjian wrote:

I just think the WARN word coming up on users terminals is odd. I can
make the change in all the source files easily if we decide what the new
error word should be. Error? Failure?

Yes, that's one of the things I don't understand with PostgreSQL.
ERROR would be much better.

How about ABORT ?

Sounds maybe a little too serious. We currently use WARN a lot to
indicate errors in the supplied SQL statement. Perhaps we need to make
the parser elog's ERROR, and the non-parser WARN's ABORT? Is that good?
When can I make the change? I don't want to mess up people's current work.

ABORT means that transaction is ABORTed.
Will ERROR mean something else ?
Why should we use two different flag-words for the same thing ?
Note, that I don't object against using ERROR, but against using two words.

Vadim

#5Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Vadim B. Mikheev (#4)

Bruce Momjian wrote:

ABORT means that transaction is ABORTed.
Will ERROR mean something else ?
Why should we use two different flag-words for the same thing ?
Note, that I don't object against using ERROR, but against using two words.

I wanted two words to distinguish between user errors like a mis-spelled
field name, and internal errors like btree failure messages.

Make sense?

No, for me. Do Informix, Oracle, etc use two words ?
What benefit of special "in-parser-error" word for user - in any case
user will read error message itself to understand what caused error.

OK, if no one likes my idea in the next day, I will make them all ERROR.

--
Bruce Momjian
maillist@candle.pha.pa.us

#6Vadim B. Mikheev
vadim@sable.krasnoyarsk.su
In reply to: Bruce Momjian (#3)

Bruce Momjian wrote:

ABORT means that transaction is ABORTed.
Will ERROR mean something else ?
Why should we use two different flag-words for the same thing ?
Note, that I don't object against using ERROR, but against using two words.

I wanted two words to distinguish between user errors like a mis-spelled
field name, and internal errors like btree failure messages.

Make sense?

No, for me. Do Informix, Oracle, etc use two words ?
What benefit of special "in-parser-error" word for user - in any case
user will read error message itself to understand what caused error.

I made all the error messages coming from the parser as ERROR, and
non-parser messages as ABORT. I think I will need to fine-tune the
messages because I am sure I missed some messages that should be ERROR
but are ABORT. For example, utils/adt messages about improper data
formats, is that an ERROR or an ABORT?

Good question :)

Following your way

insert into X (an_int2_field) values (9999999999);

should cause ERROR message, but

insert into X (an_int2_field) select an_int4_field from Y;

should return ABORT message if value of some an_int4_field in Y is
greater than 32768.

Vadim

#7Thomas G. Lockhart
lockhart@alumni.caltech.edu
In reply to: Bruce Momjian (#5)

I wanted two words to distinguish between user errors like a mis-spelled
field name, and internal errors like btree failure messages.

Make sense?

No, for me. Do Informix, Oracle, etc use two words ?
What benefit of special "in-parser-error" word for user - in any case
user will read error message itself to understand what caused error.

OK, if no one likes my idea in the next day, I will make them all ERROR.

Well, _I_ like your idea. Seems like we can distinguish between operator error
(which the operator can fix) and internal problems, and we could flag them
differently. Perhaps there are so many grey areas that this becomes difficult to
do??

- Tom

#8Vadim B. Mikheev
vadim@sable.krasnoyarsk.su
In reply to: Bruce Momjian (#5)

Thomas G. Lockhart wrote:

I wanted two words to distinguish between user errors like a mis-spelled
field name, and internal errors like btree failure messages.

Make sense?

No, for me. Do Informix, Oracle, etc use two words ?
What benefit of special "in-parser-error" word for user - in any case
user will read error message itself to understand what caused error.

OK, if no one likes my idea in the next day, I will make them all ERROR.

Well, _I_ like your idea. Seems like we can distinguish between operator error
(which the operator can fix) and internal problems, and we could flag them
differently. Perhaps there are so many grey areas that this becomes difficult to
do??

All adt/*.c are "grey areas":

insert into X (an_int2_field) values (9999999999);

should cause ERROR message, but

insert into X (an_int2_field) select an_int4_field from Y;

should return ABORT message if value of some an_int4_field in Y is
greater than 32768.

Vadim

#9Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Vadim B. Mikheev (#6)

I made all the error messages coming from the parser as ERROR, and
non-parser messages as ABORT. I think I will need to fine-tune the
messages because I am sure I missed some messages that should be ERROR
but are ABORT. For example, utils/adt messages about improper data
formats, is that an ERROR or an ABORT?

Good question :)

Following your way

insert into X (an_int2_field) values (9999999999);

should cause ERROR message, but

insert into X (an_int2_field) select an_int4_field from Y;

This generates an ERROR, because the parser catches the type mismatch.

It looks like the changes are broken up pretty much among directories.
utils/adt and catalog/ and commands/ are all pretty much ERROR.

should return ABORT message if value of some an_int4_field in Y is
greater than 32768.

Vadim

--
Bruce Momjian
maillist@candle.pha.pa.us

#10Vadim B. Mikheev
vadim@sable.krasnoyarsk.su
In reply to: Bruce Momjian (#9)

Bruce Momjian wrote:

I made all the error messages coming from the parser as ERROR, and
non-parser messages as ABORT. I think I will need to fine-tune the
messages because I am sure I missed some messages that should be ERROR
but are ABORT. For example, utils/adt messages about improper data
formats, is that an ERROR or an ABORT?

Good question :)

Following your way

insert into X (an_int2_field) values (9999999999);

should cause ERROR message, but

insert into X (an_int2_field) select an_int4_field from Y;

This generates an ERROR, because the parser catches the type mismatch.

Hm - this is just example, I could use casting here...

Vadim

#11Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Vadim B. Mikheev (#10)

This generates an ERROR, because the parser catches the type mismatch.

Hm - this is just example, I could use casting here...

Ah, you got me here. If you cast int2(), you would get a different
message. You are right.

I changes parser/, commands/, utils/adt/, and several of the /tcop
files. Should take care of most of them. Any errors coming out of the
optimizer or executor, or cache code should be marked as serious. Let's
see if it helps. I can easily make them all the same.

--
Bruce Momjian
maillist@candle.pha.pa.us