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]: TDS Column MetaData is different and looks incorrect #2402

Open
1 task done
dcowan-e-courier opened this issue Feb 28, 2024 · 1 comment
Open
1 task done
Labels
bug Something isn't working

Comments

@dcowan-e-courier
Copy link

What happened?

I have noticed ADO.net rowsets do not behave correctly when trying to do batch operations. Also inspecting rowset xml differs between mssql and babelfish. Key columns are not identified as key columns. I believe this is due to the TDS metadata for columns.

For a query like

select RateGroupID,Description from RateGroup with (readuncommitted) order by Description

I get TDS data like so
image

For babelfish 3.4 I get this result

image

Notice many flags are missing. Also notice the Identity Flag is always true even for non identity columns. Also Updateable is false for babelfish

ADO.net connections seem to rely heavily on the column metadata and its correctness.

Version

BABEL_3_X_DEV (Default)

Extension

None

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

Ubuntu (Default)

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.
@staticlibs
Copy link
Contributor

Hi,

I was investigating this metadata issue:

Notice many flags are missing.

Out of all flags:

  • fNullable
  • fCaseSen
  • usUpdateable
  • fIdentity
  • fComputed
  • usReservedODBC
  • fFixedLenCLRType
  • fSparseColumnSet
  • fEncrypted
  • fHidden
  • fKey
  • fNullableUnknown

Babelfish currently supports setting the first 5 flags. Though, due to #232 it only sets these flags when FMTONLY ON is set. For ordinary queries it always returns constant value 0x9 (0b1001):

  • fNullable: true
  • fCaseSen: false
  • usUpdateable: updateable unknown
  • fIdentity: false
  • fComputed: false

Also notice the Identity Flag is always true even for non identity columns.

It seems that Wireshark parser for this field is unreliable, on the screenshot above with babelfish 3.4 value is 0x0009, so Identity flag (5-th bit) is actually set to false.

Also Updateable is false for babelfish

Updatable flag is set to updatable unknown, that is likely to be interpreted as true by client driver (at least in mssql-jdbc).

Key columns are not identified as key columns.

M, according to fKey spec: "Its value is 1 if the column is part of a primary key for the row and the
T-SQL SELECT statement contains FOR BROWSE.". Does the problematic query/tool operation use FOR BROWSE (not supported in Babelfish)?

I have noticed ADO.net rowsets do not behave correctly when trying to do batch operations.
ADO.net connections seem to rely heavily on the column metadata and its correctness.

Is it possible to get an example of queries/tool operations that are failing due to incorrect metadata? Out of all flags it seems that only fIdentity and fComputed are applicable to Babelfish (fNullable seems to be problematic as described in #232).

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

2 participants