Error calling stored procedure with named parameter notation

Đang mở
#3,978 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, postgresql
Lĩnh vực
database

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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;
$$;
Ngôn ngữ chính
Go
Star
2.2k
Fork
93
Merge trung bình
19 giờ 38 phút
Pull request đã merge (30 ngày)
132

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của dolthub/doltgresql

Tất cả issue của dolthub/doltgresql

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.