RE: issues on error message
Hi, Yes! Glad you asked. The error message numbers are organized by what part of the software raises them. Messages 1000 - 1999 are raised by the DDL code (core/sql/sqlcomp/* modules) -- use the enum in sqlcomp/CmpDDLCatErrorCodes.h Messages 2000 - 2999 are raised by the mainline code of the SQL compiler process (core/sql/arkcmp/* modules + the core/sql/sqlcomp/* modules that aren't DDL modules) Messages 3000 - 3999 are raised by the parser code (core/sql/parser/*) Messages 4000 - 4999 are raised by the binder code (core/sql/optimizer/Bind*) Messages 5000 - 5999 are raised by the normalizer code (core/sql/optimizer/Norm*) Messages 6000 - 6999 are raised by the optimizer code (core/sql/optimizer/ ) -- use the enum in optimizer/opt_error.h Messages 7000 - 7999 are raised by the generator code (core/sql/generator/*) Messages 8000 - 8999 are raised by the executor code (core/sql/executor/* and core/sql/exp/*) -- use the enum in exp/ExpErrorEnums.h Messages 9200 - 9299 are raised by the update statistics code (core/sql/ustat/*) -- use the enum in ustat/hs_const.h Messages 1 - 10049 are raised by the run-time sort code (core/sql/sort/*) -- use the enum in sort/SortError.h Messages 11100 - 11399 are raised by the UDR server and language manager code (core/sql/udrserv/*) -- use the num in udrserv/udrdefs.h As you can see, not all of the error message ranges have corresponding enum files; we did not have a unified convention for this when we originally wrote the code unfortunately. When you add an error message, be sure to also add a description to the SQL Messages Guide. See http://trafodion.apache.org/docs/messages_guide/index.html for the latest version. The source for it can be found in $TRAF_HOME/../../docs/messages_guide/src/asciidoc/_chapters. Dave -Original Message- From: Zhu, Wen-JunSent: Tuesday, April 10, 2018 1:39 AM To: dev@trafodion.apache.org Subject: issues on error message Hi, I am trying to add some error message in SqlciErrors.txt when new error happens. As far as I know, it uses message catalog, and the error number is a enum in CmpDDLCatErrorCodes.h. I guess there is a map between these two files, but it is not exactly mapped. Are there rules about this? Like feed DgSqlCode constructor with enum, not magic number, or something like this And what should I take care of?
RE: issues on error message
The enums are just a way to access the error codes symbolically. Usually, the error codes in Trafodion have ranges assigned to different components of the Trafodion engine. The errors originating in catalog manager component are expected to be CmpDDLCatErrorCodes.h and the errors originating in executor component are in exp/ExpErrorEnums.h.However, these grouping are not strictly enforced. At times, the error codes are used without enums (symbolic names). There are many helper functions to populate the diagnostics area. Most often used functions are ExRaiseSqlErrors DgSqlCode DgString, DgInt ExRaiseSqlError is used in executor and mostly in work method of operators. It can be used when diagnostics area is not already allocated. This method allocates the diagnostics area and passes back to the caller. DgSqlCode concept is used in other areas of Trafodion when diagnostics area is already allocated and available. See https://issues.apache.org/jira/browse/TRAFODION-3009 and https://issues.apache.org/jira/browse/TRAFODION-2853 for details of the change that streamlined this concept to some extent. Selva -Original Message- From: Zhu, Wen-JunSent: Tuesday, April 10, 2018 1:39 AM To: dev@trafodion.apache.org Subject: issues on error message Hi, I am trying to add some error message in SqlciErrors.txt when new error happens. As far as I know, it uses message catalog, and the error number is a enum in CmpDDLCatErrorCodes.h. I guess there is a map between these two files, but it is not exactly mapped. Are there rules about this? Like feed DgSqlCode constructor with enum, not magic number, or something like this And what should I take care of?