Error calling stored procedure with named parameter notation

Abierto
#3,978 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, postgresql
Área
database

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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;
$$;
Lenguaje dominante
Go
Estrellas
2.2k
Forks
93
Merge medio
19 h 38 min
PR fusionados (30 d)
132

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dolthub/doltgresql

Todos los issues de dolthub/doltgresql

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.