jackc / jackc/pgx

Retrieve OUT refcursor store procedure in pgx pool

Open
#1,709 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
14.3k
Forks
1.1k
Avg merge
6d 9h
Merged PRs (30d)
11

Description

Hi admin,
here is my postgresql store procedure:
CREATE OR REPLACE PROCEDURE test.get_all_merchant (
rs out refcursor
)
LANGUAGE plpgsql
AS $procedure$
BEGIN
OPEN rs FOR
SELECT
*
FROM
test.tb_merchant
WHERE
s_state = 'approved';
END;
$procedure$;

I don't know how to use pgx pool to get out parameter in golang (here is rs refcursor). Can you guide me?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the pgx pool APIs and PostgreSQL procedure behavior for OUT refcursor parameters. Reproduce the supplied test.get_all_merchant procedure and determine how its cursor can be retrieved in Go. Done means a documented or tested example showing the complete retrieval flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.