Dialect 3 Troubleshooting
Possible Errors in Reports when switching to Firebird Dialect 3 in Communicare V18.3 and later.
In Communicare V18.3, the database dialect changed from dialect 1 to dialect 3. This change introduced a stricter standard of SQL and new reserved words, meaning some custom reports in Communicare may require modification.
Below is a list of possible errors caused by the dialect change, and how to fix them. Should the error persist, please contact Communicare Support for further assistance.
| Error | Possible Cause | Solution | 
|---|---|---|
| Access violation | Double quotes “ are not valid string delimiters in Dialect 3. In some cases, a double quote will cause an Access Violation, in other cases, a more obvious SQL error. | Replace double quotes (“) with single quotes (‘). | 
| Dynamic SQL Error: SQL error code = -206. Column unknown. | Column does not belong to referenced table. Example
                            1:  |  | 
| Example
                            2  |  | |
| Dynamic SQL Error: Expression evaluation not supported. | Strings cannot be added or subtracted in dialect 3. For
                            example: Also (frequently used in
                            reports): | Cast the dates
                            first:  | 
| Datatypes are not comparable in expression UNION. | A union has different datatypes in the select statement | Need to make sure that the columns in the union are the same datatype. We now use TIMESTAMPs instead of DATE fields. | 
| Dynamic SQL Error: Expression evaluation not supported. | Invalid data type in DATE/TIME/TIMESTAMP addition or subtraction in
                            add_datetime(). Example
                            1:  |  | 
| Example
                            2:  |  | |
| Dynamic SQL Error: Expression evaluation not supported | Strings cannot be multiplied in dialect 3. For
                            example:  | Cast the string as a
                            Numeric  | 
| Arithmetic overflow or division by zero has occurred. | Arithmetic exception, numeric overflow, or string truncation. For
                                example:
                                  |  | 
| A number of new reserved keywords are introduced. | Ensure your DSQL statements and procedure/trigger sources don't
                            contain those keywords as identifiers. Otherwise, you'll need to either
                            use them quoted (in Dialect 3 only) or rename them, or add an
                            underscore, which the reports will ignore, thus avoiding changes to the
                            report layouts. For
                            example:  |  | 
| Mixed explicit and implicit joins | Improperly mixed explicit and implicit joins are not supported anymore, as per the SQL specification. It also means that in the explicit A JOIN B ON <condition>, the condition is not allowed to reference any stream except A and B. | See examples above. | 
| FieldName: ______ not found | This could be a missing alias for a cast in the parameters
                            section  |  | 
| No error but incorrect data whenever dividing two integers where the result is an integer. | In dialect 1 the result of dividing two integers is rounded up or down (14/10 = 1 and 15/10 = 2) but in dialect 3 it is always rounded down (14/10 and 15/10 are both 1) | When dividing integers always cast integers as floats before doing the division. | 
| String Overflow | Casting a timestamp that has a time as varchar(11) now results in a
                            string overflow issue. This technique was used in the distant past
                            before we had the cu_formatdatetime function. The offending code looks
                            like
                            this:  | Use the
                            UDF:  | 
- All DATE fields that need to contain a time need to be changed to a TIMESTAMP
- All DATE fields that need to contain a time ONLY need to be changed to a TIME
