Skip to content

Add curve constructor functions - #1073

Draft
Komzpa wants to merge 4 commits into
postgis:masterfrom
Komzpa:codex/ticket-1291-curve-constructors
Draft

Komzpa wants to merge 4 commits into
postgis:masterfrom
Komzpa:codex/ticket-1291-curve-constructors

Conversation

@Komzpa

@Komzpa Komzpa commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • add ST_MakeCurveLine constructors for three points and point arrays
  • add ST_MakeCompoundCurve for continuous LineString, CircularString, and NURBSCurve arrays
  • document and regress constructor success and validation/error cases
  • clarify NEWS wording so the entry describes the new curve constructors without implying unrelated ST_MakePolygon scope

Trac ticket: https://trac.osgeo.org/postgis/ticket/1291

Validation on rebased head 5cf192375509fd1fd11299c26913781046cb2710

  • ./autogen.sh && ./configure --with-jsondir=/usr --with-projdir=/usr --with-raster --with-topology --with-sfcgal
  • make postgis_revision.h
  • make -C postgis -j32
  • make -C extensions postgis_extension_helper.sql
  • make -B -C extensions/postgis sql/postgis_for_extension.sql sql/postgis--3.7.0dev.sql
  • make -C extensions/postgis -j1
  • sudo -n make -C postgis install
  • sudo -n make -C extensions/postgis install
  • make -C regress check RUNTESTFLAGS="--extension --verbose" TESTS="$(pwd)/regress/core/ctors" (fresh and upgrade: Run tests: 3, Failed: 0)
  • make -C doc check-xml
  • make check-news && ./utils/check_news.sh .
  • git clang-format --diff upstream/master -- postgis/lwgeom_functions_basic.c postgis/postgis.sql.in doc/reference_constructor.xml regress/core/ctors.sql regress/core/ctors_expected NEWS
  • git diff --check upstream/master..HEAD && git diff --check && git diff --cached --check

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds ST_MakeCurveLine for CIRCULARSTRING construction and ST_MakeCompoundCurve for COMPOUNDCURVE construction, with C implementations, SQL declarations, documentation, release notes, and regression tests.

Changes

Curve Geometry Constructors

Layer / File(s) Summary
Curve constructor implementations
postgis/lwgeom_functions_basic.c
Adds both LWGEOM entry points with input validation, SRID and dimensionality checks, curve construction, serialization, and cleanup.
SQL declarations and public documentation
postgis/postgis.sql.in, doc/reference_constructor.xml, NEWS
Registers the constructor signatures, documents their behavior and examples, and adds the 3.7.0beta1 release-note entry.
Constructor regression coverage
regress/core/ctors.sql, regress/core/ctors_expected
Covers successful construction, dimensional and SRID variants, null or empty arrays, and validation errors.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested labels: enhancement, documentation

Suggested reviewers: pramsey

Sequence Diagram(s)

sequenceDiagram
  participant SQL
  participant LWGEOM_makecurveline_garray
  participant LWGEOM_makecompoundcurve_garray
  participant GeometrySerializer
  SQL->>LWGEOM_makecurveline_garray: pass point geometry array
  LWGEOM_makecurveline_garray->>LWGEOM_makecurveline_garray: validate points, SRIDs, dimensions, and count
  LWGEOM_makecurveline_garray->>GeometrySerializer: serialize CIRCULARSTRING
  SQL->>LWGEOM_makecompoundcurve_garray: pass curve geometry array
  LWGEOM_makecompoundcurve_garray->>LWGEOM_makecompoundcurve_garray: validate components, SRIDs, dimensions, and joins
  LWGEOM_makecompoundcurve_garray->>GeometrySerializer: serialize COMPOUNDCURVE
Loading

Poem

🐰 Two new curves hop into view,
Circular and compound, both shiny and new.
SRIDs align, points join with care,
Z and M travel through the air.
Tests and docs follow their trail.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding new curve constructor functions.
Description check ✅ Passed The description accurately summarizes the new curve constructors, docs, tests, and NEWS update.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@NEWS`:
- Around line 50-51: The release note for issue `#1291` incorrectly groups all
three functions (ST_MakeCurveLine, ST_MakeCompoundCurve, and ST_MakePolygon)
under "curved rings support", which misrepresents their scope. Reword the bullet
point to separate ST_MakeCurveLine and ST_MakeCompoundCurve as general curve
constructors from ST_MakePolygon, which specifically adds curved-ring support.
This clarification ensures readers understand that only ST_MakePolygon is
related to curved rings while the other two are broader curve-building
functions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f23ee2a-29e0-46d8-9979-639cb161d9e3

📥 Commits

Reviewing files that changed from the base of the PR and between 986bb6a and 867ca29.

📒 Files selected for processing (6)
  • NEWS
  • doc/reference_constructor.xml
  • postgis/lwgeom_functions_basic.c
  • postgis/postgis.sql.in
  • regress/core/ctors.sql
  • regress/core/ctors_expected

Comment thread NEWS Outdated
@Komzpa
Komzpa marked this pull request as draft June 22, 2026 06:44
@robe2
robe2 requested a review from pramsey June 24, 2026 02:22
@Komzpa
Komzpa force-pushed the codex/ticket-1291-curve-constructors branch 3 times, most recently from 72a41da to 36b0040 Compare July 6, 2026 12:01
@Komzpa
Komzpa force-pushed the codex/ticket-1291-curve-constructors branch 2 times, most recently from d83f962 to b40bb13 Compare July 9, 2026 12:45
@Komzpa
Komzpa force-pushed the codex/ticket-1291-curve-constructors branch from b40bb13 to 990b596 Compare July 17, 2026 22:41
@Komzpa
Komzpa force-pushed the codex/ticket-1291-curve-constructors branch 4 times, most recently from a880a97 to 9787666 Compare July 28, 2026 21:32
@Komzpa
Komzpa force-pushed the codex/ticket-1291-curve-constructors branch from 9787666 to 0777f6c Compare August 2, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants