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

babelfish-for-postgresql / babelfish_extensions / 23299065744
77%
BABEL_5_X_DEV: 77%

Build:
Build:
LAST BUILD BRANCH: BABEL_6329_6x
DEFAULT BRANCH: BABEL_5_X_DEV
Ran 19 Mar 2026 02:50PM UTC
Jobs 1
Files 121
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

19 Mar 2026 02:11PM UTC coverage: 77.05%. Remained the same
23299065744

push

github

web-flow
Implement STGeometryType for geometry and geography types (#4669)

Implemented the `STGeometryType()` method for both `sys.GEOMETRY` and `sys.GEOGRAPHY` types, extending the existing geospatial functionality in Babelfish. This function returns the geometry type name (Point, LineString, Polygon, etc.) with full TSQL compatibility.

#### Changes Made

**Function Implementations:**
- `STGeometryType` for `sys.GEOMETRY` - Returns geometry type name with proper validation
- `STGeometryType` for `sys.GEOGRAPHY` - Returns geography type name with same behavior
- Utilizes PostGIS functions with necessary adjustments for TSQL compatibility
- Strips 'ST_' prefix from PostGIS type names to match TSQL Server format

**Key Features:**
- **Input Validation:** Validates geometry/geography instances using `STIsValid()` before processing
- **Error Handling:** Throws appropriate exceptions for invalid instances
- **SQL Server Compatibility:** Returns `sys.NVARCHAR` type and matches TSQL naming conventions
- **NULL Handling:** Proper handling of NULL inputs with STRICT function attribute
- **Thread Safety:** Implemented with PARALLEL SAFE attribute

---

#### Examples

**For STGeometryType (Geometry):**

    DECLARE @geom geometry;
    SET @geom = geometry::STGeomFromText('POINT(1 2)', 4326);
    SELECT @geom.STGeometryType();

**Output:** `Point`

**For STGeometryType (Geography):**

    DECLARE @geog geography;
    SET @geog = geography::STGeomFromText('LINESTRING(-122.36 47.65, -122.34 47.66)', 4326);
    SELECT @geog.STGeometryType();

**Output:** `LineString`

**Table Operations:**

    SELECT ID, GeomColumn.STGeometryType() AS GeometryType 
    FROM TestTable 
    WHERE GeomColumn.STGeometryType() = 'Point';

---

#### Files Modified

- `geometry.sql` - Added STGeometryType for geometry type
- `geography.sql` - Added STGeometryType for geography type
- `spatial_types--6.0.0--6.1.0.sql` - Upgrade script
- Test files with comprehensive coverage

Task: BABEL-6310
Sig... (continued)

52917 of 68679 relevant lines covered (77.05%)

643410.63 hits per line

Jobs
ID Job ID Ran Files Coverage
1 23299065744.1 19 Mar 2026 02:50PM UTC 121
77.05
GitHub Action Run
Source Files on build 23299065744
  • Tree
  • List 121
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #23299065744
  • 07104a66 on github
  • Prev Build on BABEL_6_X_DEV (#23007477055)
  • Next Build on BABEL_6_X_DEV (#23318015899)
  • 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