Error message mnemonic needs to be displayed in error to tie with documentation in errors.rst
Currently, an error only displays the error text and not the error message mnemonic.
For example, below is the output for an AGGREGATE_FUNCTION_NESTED
error.
Query output
OCTO> SELECT 1+2*AVG(AVG(id)) FROM names;
[ERROR] src/qualify_statement.c:183 2020-09-08 16:42:41 : Aggregate function calls cannot be nested
Error with syntax near (line 1, column 15):
SELECT 1+2*AVG(AVG(id)) FROM names;
^^^^^^^
The coresponding documentation refers to the error message mnemonic as can be seen below.
doc/errors.rst
++++++++++++++++++++++++++++
AGGREGATE_FUNCTION_NESTED
++++++++++++++++++++++++++++
This error is generated when aggregate function calls are nested, which is not allowed. PSQL Error Code: 42803
But given an [ERROR]
message output of Aggregate function calls cannot be nested
, I have no easy way of tying it to the AGGREGATE_FUNCTION_NESTED
error documentation in doc/errors.rst
.
- One way of fixing this would be for the error message output to contain
AGGREGATE_FUNCTION_NESTED
too. For example, something like the following.
[ERROR] src/qualify_statement.c:183 2020-09-08 16:42:41 : AGGREGATE_FUNCTION_NESTED: Aggregate function calls cannot be nested
- An alternative approach would be to include the error message text in the documentation. For example, have the following in
doc/errors.rst
.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AGGREGATE_FUNCTION_NESTED : Aggregate function calls cannot be nested
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This error is generated when aggregate function calls are nested, which is not allowed. PSQL Error Code: 42803
- Another alternative would be to implement (1) and (2).
(3) seems the most user-friendly but I am fine even if just (1) is implemented.