porsager / porsager/postgres

Missing documentation on how to handle refcursors

Open
#1,134 1 comment 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

I have a stored function returning a refcursor. I am able to retrieve the "<unnamed portal 1>" from the call. But I cannot figure out how to retrieve the rows of the refcursor.

            logger.debug(`refcursor=${refcursor}`)
            const cursor = conn`FETCH ALL IN "${refcursor}";`.cursor()

Further down there is a catch clause logging the error.

[12:36:10.198] ▶ DEBUG refcursor=<unnamed portal 1> src=dogwrapper
[12:36:10.200] ▶ ERROR fn_dogs_aggregate_v1: "Caught PostgresError: could not determine data type of parameter $1, rethrowing. 

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 stored-function/refcursor example and the conn call using FETCH ALL IN shown in the issue. Document the supported way to retrieve the refcursor rows and clarify the parameter-type error case, using the reported behavior as the completion check.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, postgresql
Domain
databases
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.