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

Legacy configuration to COUNT return an INTEGER instead of BIGINT [CORE6259] #6501

Closed
firebird-automations opened this issue Mar 2, 2020 · 20 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Beto Neto (betoneto.tbo)

Votes: 3

The new version of Firebird 3 causes a lot of impacts on legacy applications with the COUNT function.

A very useful feature would be, if it existed an configuration to rollback the return type of COUNT from BIGINT to INTEGER.

I know that exists workarrounds like "CAST(count(*) as INTEGER)" but the work to add an CAST to all COUNTs can be very expensive. The simple way could be just "ativate" a backward compatibility property in firebird.conf like the 'AuthClient = Legacy_Auth'.

@firebird-automations
Copy link
Collaborator Author

Commented by: @aafemt

No new features in stable branches, please.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

What impact the data type change caused?

@firebird-automations
Copy link
Collaborator Author

Commented by: @livius2

Adriano,
if you have form with fields components
and such component is TIntegerField it have buffer only for 4 bytes and trie to move more cause an error and this part of application cannot work.
It is simple fixable but only manually by changing definition and recompailing application.

@firebird-automations
Copy link
Collaborator Author

Modified by: Beto Neto (betoneto.tbo)

issuetype: New Feature [ 2 ] => Improvement [ 4 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

This is a problem with the component library.

Libraries may be designed such as this type of problem could not happen.

@firebird-automations
Copy link
Collaborator Author

Commented by: Beto Neto (betoneto.tbo)

"This is a problem with the component library."

I do not agree, this is a broke of backward compatibility, as I say, in my vision firebird could have an configuration property to maintain the old behavior (count returning as integer).

The component library maps the types correctly, it was a Integer and now is a Int64 (bingint).

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

I am inclined to agree Beto, however, one question...

What database dialect are you using? 1 or 3?

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

The mapped type may still work when the type is changed if the component library / application is well coded thinking in maintainability.

@firebird-automations
Copy link
Collaborator Author

Commented by: @livius2

Adriano this is not library problem, this is developer choice.
In Delphi you can store persistent field definition or do not store it at all.
I prefere second choice. It is more flexible and have not such problems.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

If this is "this is developer choice" then in this choice must be the desire to update the code when Firebird improve things, instead of wanting Firebird to create such type of config to support bad developer choices.

This ticket should be closed as won't fix IMO.

@firebird-automations
Copy link
Collaborator Author

Commented by: Beto Neto (betoneto.tbo)

"to support bad developer choices" ?

This is the API of Delphi (in this case), if I must not use it features (add TFields to dataset) just to prevent "firebird improvements" incompatibilities, I don't know for what they have been created.

For me this is the same case of the other improvements over the security, where we can set the legacy behavior:

AuthServer = Legacy_Auth
AuthClient = Legacy_Auth
UserManager = Legacy_UserManager

@firebird-automations
Copy link
Collaborator Author

Commented by: Beto Neto (betoneto.tbo)

The real problem here is that the Delphi 7 doesn't handle BIGINT (int64) types.

Even the dataset maps the field to a FMTBCD, when you try to get the value a overflow exception is thrown.

So the only solution is cast all counts to integer or (please) implement this issue.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Beto,

One more time... what database dialect are you using?

@firebird-automations
Copy link
Collaborator Author

Commented by: Beto Neto (betoneto.tbo)

Dialect 3

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

That is your problem!

The "Legacy Support" relates to functional changes which the project has made to the Firebird v1.0 functionality (after which the project takes responsibility).

Dialect 3 has always returned COUNT() as BIGINTs, a feature implementation of Interbase v5.5 which pre-dates the Firebird project.

Either;
1- upgrade to newer Delphi version which may have appropriate BIGINT support
2- 'downgrade' the database dialect -- dialect 1 would return INT for COUNT()

IMO, your problem is not the Firebird project's to resolve (as Adriano and Karol have commented).

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Sean, you're wrong. Historically, COUNT was always returning INTEGER.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

OK, sorry.

But does that change how we will handle this ticket?

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

We had discussed that at the last conference in Berlin. Some people complain and I agree that could be a PITA. Basically, this might be the only significant showstopper for migration to FB3. But the change was obviously done for purpose, tables and cursors with more than 2^31 records in not a science fiction these days. In the past, we used to add backward compatibility config options under users' pressure, but amount of affected users should be noticable for that. So far I don't see us hitting that point. Delphi 7 with no BIGINT support is not an argument at all. It was released 18 years ago, so why should we care? Moreover, users may always skip FB3 and wait for FB4 with its SET BIND feature.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant