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

[Bug]: sql_variant always uses max scale with time and datetime2 types #2638

Open
1 task done
staticlibs opened this issue May 31, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@staticlibs
Copy link
Contributor

What happened?

With a table like this:

create table tab1(col1 sql_variant)
insert into tab1 values(cast('12:45:37.123' as time(2)))
insert into tab1 values(cast('2016-10-23 12:45:37.123' as datetime2(2)))
select * from tab1

MSSQL returns:

12:45:37.12
2016-10-23 12:45:37.12

And Babelfish returns:

12:45:37.1200000
2016-10-23 12:45:37.1200000

It seems that data is stored with a correct scale, but this scale is not available when tuples are printed out. Scale values read in TdsGetMetaData does not return correct scale and resulting garbage values are treated as max scale.

I've stumbled upon this when fixing remaining test failures for #2320 , I don't intend to try to address this scale problem now, so filing the issue for the record.

Version

BABEL_4_X_DEV (Default)

Extension

babelfishpg_common

Which flavor of Linux are you using when you see the bug?

Fedora

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.
@staticlibs staticlibs added the bug Something isn't working label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant