Error calling stored procedure with named parameter notation

Aperta
#3,978 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, postgresql
Ambito
database

Direzione di ricerca

The issue shows a CALL with named arguments (p_name => ...) failing with a syntax error at >, while positional arguments succeed. The payload names no source files, so start by reproducing the failing call against a local doltgresql server with the add_organization procedure from the issue. Then find where the CALL statement is parsed and how named-argument notation is handled there. Done means the named-argument call returns CALL and inserts the row, and the positional form still works.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

customer issue

I have a stored procedure. When I call it using named parameters the call fails. When I call is using positional parameters it succeeds.

pi5@pi5:~ $ psql -h pi5.local -p 5432 -U sarzone_rw_user sarzone
Password for user sarzone_rw_user: 
psql (17.12 (Debian 17.12-0+deb13u1), server 15.17)
Type "help" for help.

sarzone=> CALL add_organization(
    p_name => 'Mid-Minnesota K9 Inc',
    p_subdivision_codes => ARRAY['US-MN'],
    p_url => 'https://www.midmnk9.com',
    p_type => 'team'
);
ERROR:  at or near ">": syntax error
sarzone=> CALL add_organization('team', 'Mid-Minnesota K9 Inc.', 'https://www.midmnk9.com', ARRAY['US-MN']);
CALL
sarzone=> 

Stored procedure is

CREATE PROCEDURE add_organization(
    p_type              varchar,
    p_name              varchar,
    p_url               varchar,
    p_subdivision_codes varchar[]
)
LANGUAGE plpgsql
AS $$
DECLARE
    v_org_id uuid;
BEGIN
    IF p_type IS NULL THEN
        -- table default ('team') applies
        INSERT INTO organizations (name, url)
        VALUES (p_name, p_url)
        RETURNING id INTO v_org_id;
    ELSIF p_type = 'organization' THEN
        INSERT INTO organizations (name, url, type)
        VALUES (p_name, p_url, 'organization')
        RETURNING id INTO v_org_id;
    ELSIF p_type = 'team' THEN
        INSERT INTO organizations (name, url, type)
        VALUES (p_name, p_url, 'team')
        RETURNING id INTO v_org_id;
    ELSE
        RAISE EXCEPTION 'Invalid organization type: %', p_type;
    END IF;

    INSERT INTO organization_locations (organization_id, subdivision_code)
    SELECT v_org_id, code
    FROM (
        SELECT DISTINCT unnest(p_subdivision_codes) AS code
    ) AS s
    WHERE code IS NOT NULL;
END;
$$;
Lingua principale
Go
Stelle
2.2k
Fork
93
Merge medio
19h 38m
PR unite (30g)
132

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dolthub/doltgresql

Tutte le issue di dolthub/doltgresql

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.