• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

babelfish-for-postgresql / babelfish_extensions / 25160290191
76%
BABEL_6_X_DEV: 77%

Build:
Build:
LAST BUILD BRANCH: SELECT-COUNT(-)-AS-matches
DEFAULT BRANCH: BABEL_6_X_DEV
Ran 30 Apr 2026 11:00AM UTC
Jobs 1
Files 120
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Apr 2026 10:23AM UTC coverage: 76.012% (+0.008%) from 76.004%
25160290191

push

github

web-flow
Fix sql_variant type resolution in CASE, UNION, INTERSECT, EXCEPT, VALUES, and COALESCE expressions (#4787)

Expressions fail when sql_variant is mixed with other types in type-resolution contexts:

-- CASE: fails
SELECT CASE WHEN 1 = 1 THEN SERVERPROPERTY('IsFullTextInstalled') ELSE CAST(0 AS bit) END;
-- Error: CASE/WHEN could not convert type sql_variant to "bit"
-- COALESCE: fails
SELECT COALESCE(CAST(NULL AS sql_variant), CAST('hello' AS varchar(50)));
-- Error: COALESCE could not convert type sql_variant to "varchar"
The same class of issue affects UNION, INTERSECT, EXCEPT, and VALUES when sql_variant is mixed with non-char types.

Fix
select_common_type_setop - Added a pre-scan before the main loop: if any expression is sql_variant, return it immediately as the common type. This applies to all contexts routed through this function (CASE, UNION, INTERSECT, EXCEPT, VALUES). sql_variant has the highest TSQL precedence (0) and can hold any type, so it always wins.

select_common_type_for_coalesce_function - In the NULL-skipping logic, if the NULL arg's type is sql_variant, still consider it for precedence before continuing.

Both fixes use is_tsql_sqlvariant_datatype to narrowly target only sql_variant. No other types or code paths are affected.

select_common_type_for_coalesce_function also includes a minor cleanup: the UNKNOWNOID (string literal) handling was simplified by replacing ptype in-place and falling through to the shared precedence comparison, instead of duplicating the comparison inline with a separate continue. This is semantically equivalent and notstrictly required for the sql_variant fix.

Tasks:
BABEL-6402
BABEL-6427

cherry-picked from #4706

Authored by: Mohit Raj mrxmohit@amazon.com

16 of 16 new or added lines in 1 file covered. (100.0%)

2 existing lines in 1 file now uncovered.

50580 of 66542 relevant lines covered (76.01%)

398348.38 hits per line

Coverage Regressions

Lines Coverage ∆ File
2
76.16
-0.62% contrib/babelfishpg_tds/src/backend/tds/tdscomm.c
Jobs
ID Job ID Ran Files Coverage
1 25160290191.1 30 Apr 2026 11:00AM UTC 120
76.01
GitHub Action Run
Source Files on build 25160290191
  • Tree
  • List 120
  • Changed 4
  • Source Changed 1
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #25160290191
  • 6256de11 on github
  • Prev Build on BABEL_4_10_STABLE (#24791179409)
  • Next Build on BABEL_4_10_STABLE (#25791796698)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc