Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect values within SQLDA structure in firebird 4 (php-8.0.1-interbase-1.1.1-linux-x64.so) #26

Open
koltsov4 opened this issue Nov 1, 2021 · 9 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@koltsov4
Copy link

koltsov4 commented Nov 1, 2021

Hi.
php-8.0.1-interbase-1.1.1-linux-x64.so does not work in firebird 4 with DECIMAL or NUMERIC types when using the SUM function. As a result, I get Incorrect values within SQLDA structure.
For example select sum (p.balance) from dog p will not work if the data type is DECIMAL.
Similarly, it does not work if any operations occur inside the sum, for example, if the field is made INTEGER and the following query is executed select sum (p.balance * 100) from dog p similarly we get Incorrect values within SQLDA structure
Also does not work with TIMESTAMP WITH TIME ZONE fields. For example, select * from MON $ ATTACHMENTS will return an error Incorrect values within SQLDA structure

@koltsov4 koltsov4 changed the title Incorrect values within SQLDA structure in firebird 4 Incorrect values within SQLDA structure in firebird 4 (php-8.0.1-interbase-1.1.1-linux-x64.so) Nov 1, 2021
@mrotteveel
Copy link
Member

As a workaround, set DataTypeCompatibility to 3.0 or 2.5 in either firebird.conf (server wide), or per-database in databases.conf. This seems to be the same issues as reported in #24.

@koltsov4
Copy link
Author

koltsov4 commented Nov 1, 2021

This problem is with 4.0. With 3.0 it works fine.

@mrotteveel
Copy link
Member

mrotteveel commented Nov 1, 2021

The problem is that Firebird 4.0 introduced wider NUMERIC and DECIMAL (38 digits, previous versions supported 18 digits), and an INT128 type, these get used for some of the aggregate functions and other calculations. The DataTypeCompatibility setting when set to 3.0, will ensure that Firebird 4.0 will not return the new data types, but instead it will convert (cast) them to types as supported by Firebird 3.0. See also the Firebird 4.0 release notes, section DataTypeCompatibility.

To be clear, I don't maintain the Firebird PHP driver. This is a workaround you can use until this gets fixed in the driver.

@koltsov4
Copy link
Author

koltsov4 commented Nov 2, 2021

Thanks! Indeed, it helped.

But not quite to the end. For example, TIMESTAMP WITH TIME ZONE is converted to TIMESTAMP, but “select * from MON$ATTACHMENTS” will still not work because there is a type BOLLEAN. “Select p.mon $ wire_compressed from MON$ATTACHMENTS p” will return “Incorrect values within SQLDA structure”. But this is not important, since the structure worked from the old configuration.

PS: it surprised me, because 3.0 also has a BOLLEAN type. I just never used it. Perhaps a similar driver problem exists when working with 3.0.

@mrotteveel
Copy link
Member

If you do have a boolean somewhere, you need to set DataTypeCompatibility to 2.5, so boolean is also converted. As I said, I don't maintain the Firebird PHP driver (nor do I use it), so I don't know all the ins and outs of it.

@MartinKoeditz MartinKoeditz self-assigned this Nov 27, 2021
@MartinKoeditz MartinKoeditz added bug Something isn't working enhancement New feature or request labels Nov 27, 2021
@MartinKoeditz
Copy link
Collaborator

The problem is not related to BOOLEAN, but to TIMESTAMP field CREATION_DATE.
If I set DataTypeCompatibility to 3.0 everything works fine.

So I will investigate in the new timezone feature.

@buhlerax
Copy link

Good Morning,
Any news about the extension's compatibility with the new firebird 4.0 types?

@MartinKoeditz
Copy link
Collaborator

MartinKoeditz commented Jan 26, 2023 via email

@hmoffatt
Copy link

Is there any progress on support for TIMESTAMP WITH TIME ZONE ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants