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

babelfish-for-postgresql / babelfish_extensions / 23201281758
77%

Build:
DEFAULT BRANCH: BABEL_5_X_DEV
Ran 17 Mar 2026 03:46PM UTC
Jobs 1
Files 121
Run time 2min
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

17 Mar 2026 03:10PM UTC coverage: 77.055% (+0.002%) from 77.053%
23201281758

push

github

web-flow
 [PART-1] Figure and Shape Parser support (#4592)

Fix geography validation bugs, replace ad-hoc CLR binary metadata parsing with spec-compliant implementation, and fix polygon Valid flag in properties byte.

**Currently**, Babelfish has the following issues in `spatialtypes.c`:

1. **Geography accepts out-of-range longitude values.** `geography::Point(45, 20000, 4326)` succeeds silently. T-SQL enforces longitude bounds of −15069 to +15069 degrees and rejects this input.

2. **Geometry/geography accepts Infinity coordinates.** Binary data containing `±Infinity` coordinate values passes all validation because only `isnan()` is checked, not `isinf()`. T-SQL rejects both NaN and Infinity.

3. **CLR binary metadata (Figure/Shape arrays) is parsed incorrectly.** The old `check_geom_end_metadata()` reads 4 bytes at a time across 5-byte figure entry boundaries. It works only because the attribute byte happens to produce the expected uint32 value when the following offset bytes are zeros. No bounds checking exists on metadata reads.

4. **Polygon properties byte missing Valid flag.** Babelfish outputs `0x00` for valid 2D polygons while T-SQL outputs `0x04` (V flag set). Linestrings already handled valid/invalid variants correctly.

5. **`set_dimension_flag()` prematurely guesses geometry type.** Properties byte `0x04` was hardcoded as `LINE_TYPE`, creating a latent bug where valid polygons from T-SQL would be misidentified.

**With this change:**

1. New `validate_longitude_range()` and `validate_not_inf_nan()` functions added and integrated into all validation paths (text input, binary input, direct point creation). Geography objects with longitude outside ±15069° are now rejected.

2. `check_nan_coordinates()` now checks both `isnan()` and `isinf()`. All geography validation paths also check for infinity.

3. New `parse_figures_and_shapes()` replaces `check_geom_end_metadata()`. Reads figure entries as 1+4 bytes and shape entries as 4+4+1 bytes per the T-SQ... (continued)

353 of 388 new or added lines in 1 file covered. (90.98%)

10 existing lines in 1 file now uncovered.

52985 of 68763 relevant lines covered (77.05%)

405621.68 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
35
94.76
-2.64% contrib/babelfishpg_common/src/spatialtypes.c

Uncovered Existing Lines

Lines Coverage ∆ File
10
94.76
-2.64% contrib/babelfishpg_common/src/spatialtypes.c
Jobs
ID Job ID Ran Files Coverage
1 23201281758.1 17 Mar 2026 03:46PM UTC 121
77.05
GitHub Action Run
Source Files on build 23201281758
  • Tree
  • List 121
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #23201281758
  • 9b12b10a on github
  • Prev Build on BABEL_5_X_DEV (#23181222033)
  • 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