porsager / porsager/postgres

Add support for geometric types

Open
#759 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
8.7k
Forks
374
Avg merge
11d 16h
Merged PRs (30d)
1

Description

Relevant documentation

It would be nice if these were returned as arrays of numbers rather than strings.

For parsing it should be easy enough - replace parentheses (( )), braces ({ }), and chevrons (< >) with square brackets and then do a JSON.parse().

For serialising, this might be more complicated, as we'll need to make the sql() function handle arrays of arrays. It seems to work at the moment, but typescript isn't very happy about it.

I'm happy to do a PR, if you think this is worth adding @porsager.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PostgreSQL geometric type documentation and the existing parsing path, using JSON.parse() as the proposed conversion approach. Then inspect the sql() function's handling of arrays of arrays and its TypeScript types. Done means geometric values are returned as numeric arrays and can be serialized without TypeScript errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, postgresql
Domain
database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.