Skip to content

fix(graphile-postgis): detect PostGIS when only geography codecs are present#935

Merged
pyramation merged 1 commit intomainfrom
devin/1774858518-fix-postgis-geography-only-detection
Mar 30, 2026
Merged

fix(graphile-postgis): detect PostGIS when only geography codecs are present#935
pyramation merged 1 commit intomainfrom
devin/1774858518-fix-postgis-geography-only-detection

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

Summary

PostgisExtensionDetectionPlugin previously required a geometry codec to detect PostGIS. Databases that exclusively use geography columns (e.g. all DataPostGIS nodes with use_geography: true, as in agentic-db) never have a geometry codec introspected, so PostGIS detection silently failed. This produced warnings like:

Do not know how to convert PgCodec 'geography' into a GraphQL type

Root cause: The detection guard was if (!geometryCodec) return build — now changed to if (!geometryCodec && !geographyCodec) return build.

Changes across 4 files:

  • types.ts: geometryCodec is now PgCodec | null (was PgCodec), symmetric with geographyCodec
  • detect-extension.ts: Accept either codec for detection; extract schemaName from geography codec when geometry is absent
  • connection-filter-operators.ts / within-distance-operator.ts: Conditionally push geometryCodec into codec pairs only when non-null (matches existing geographyCodec pattern)

Review & Testing Checklist for Human

  • Verify no other consumers of PostgisExtensionInfo.geometryCodec outside this package assume it is non-null. The type changed from PgCodec to PgCodec | null — the build passes across the monorepo, but confirm no external packages depend on it being non-null at runtime.
  • Verify register-types.ts line 97 — it already filters nulls via .filter((c): c is PgCodec => c !== null), but confirm this is the only place that iterates over both codecs.
  • Test with agentic-db integration tests after this is published — run the integration test suite and confirm the geography codec warnings are gone and location_geo fields appear in the GraphQL schema.

Notes

  • All 208 graphile-postgis unit tests and 35 preset-integration tests pass locally.
  • Full monorepo build succeeds with no type errors.
  • No new tests were added for the geography-only detection path specifically — existing tests cover the geometry+geography case and the no-PostGIS case. Consider adding a geography-only unit test to detect-extension.test.ts if desired.

Link to Devin session: https://app.devin.ai/sessions/6dd1a19fd02948fda1fee04c955f4bf2
Requested by: @pyramation

…present

Previously, PostgisExtensionDetectionPlugin required a geometry codec to
detect PostGIS. Databases that use only geography columns (e.g. all
DataPostGIS nodes with use_geography: true) would not have a geometry
codec introspected, causing PostGIS detection to silently fail and
geography columns to be omitted from the GraphQL schema with warnings:

  Do not know how to convert PgCodec 'geography' into a GraphQL type

Changes:
- detect-extension.ts: Accept either geometry OR geography codec
- detect-extension.ts: Extract schemaName from geography codec when
  geometry is absent
- types.ts: Make geometryCodec nullable (PgCodec | null)
- connection-filter-operators.ts: Handle null geometryCodec in codec
  pairs
- within-distance-operator.ts: Handle null geometryCodec in codec pairs
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 0dccae7 into main Mar 30, 2026
43 checks passed
@pyramation pyramation deleted the devin/1774858518-fix-postgis-geography-only-detection branch March 30, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant