Description
Bug Report
IvorySQL Version
PostgreSQL 18.0 (IvorySQL 5.0) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14+deb12u1) 12.2.0, 64-bit
Docker image: ivorysql/ivorysql:5.0-bookworm
OS Version (uname -a)
Linux 6.8.0-87-generic #88-Ubuntu SMP PREEMPT_DYNAMIC x86_64 GNU/Linux
Configuration options (config.status --config)
'--prefix=/var/local/ivorysql/ivorysql-5' '--enable-cassert' '--enable-debug' '--enable-rpath' '--with-tcl' '--with-python' '--with-gssapi' '--with-pam' '--with-ldap' '--with-openssl' '--with-libedit-preferred' '--with-uuid=e2fs' '--with-ossp-uuid' '--with-libxml' '--with-libxslt' '--with-perl' '--without-icu'
Current Behavior
When calling a package procedure using mixed positional and named parameters, if a named parameter value is a variable (not a literal), the call fails with:
ERROR: failed to find conversion function from unknown to varchar2
Expected behavior/code
The procedure call should succeed. This is valid PL/SQL syntax and works correctly on Oracle Database.
Steps to reproduce
-
Connect to IvorySQL on the Oracle-compatible port (1521)
-
Create the following package:
CREATE OR REPLACE PACKAGE test_named_param IS
PROCEDURE proc_with_defaults(
p1 IN VARCHAR2,
p2 IN VARCHAR2 DEFAULT NULL,
p3 IN VARCHAR2 DEFAULT NULL
);
END;
/
CREATE OR REPLACE PACKAGE BODY test_named_param IS
PROCEDURE proc_with_defaults(
p1 IN VARCHAR2,
p2 IN VARCHAR2 DEFAULT NULL,
p3 IN VARCHAR2 DEFAULT NULL
) IS
BEGIN
DBMS_OUTPUT.PUT_LINE('p1=' || p1 || ', p2=' || p2 || ', p3=' || p3);
END;
END;
/- Try to call the procedure with mixed positional and named parameters using a variable:
DO $$
DECLARE
v_val VARCHAR2(64) := 'hello';
BEGIN
test_named_param.proc_with_defaults('a', p3=>v_val);
END;
$$ LANGUAGE plisql;- Error occurs:
ERROR: failed to find conversion function from unknown to varchar2
CONTEXT: SQL statement "CALL test_named_param.proc_with_defaults('a', p3=>v_val)"
PL/iSQL function inline_code_block line 5 at CALL
What works vs what fails
| Call Pattern | IvorySQL | Oracle |
|---|---|---|
proc('a', 'b', 'c') |
✅ Works | ✅ Works |
proc('a', p3=>'literal') |
✅ Works | ✅ Works |
proc(p1=>'a', p2=>'b', p3=>v_val) |
✅ Works | ✅ Works |
proc('a', p3=>v_val) |
❌ FAILS | ✅ Works |
Workaround: Use all named parameters instead of mixing positional and named:
DO $$
DECLARE
v_val VARCHAR2(64) := 'hello';
BEGIN
-- This works:
test_named_param.proc_with_defaults(p1=>'a', p2=>NULL, p3=>v_val);
END;
$$ LANGUAGE plisql;Additional context that can be helpful for identifying the problem
- The issue only occurs when mixing positional and named parameters AND the named parameter is a variable
- Using all positional parameters works
- Using all named parameters works
- Using mixed parameters with literals works
- The bug appears to be in how PL/iSQL resolves variable types when reordering/filling default parameters
- Tested on Docker image
ivorysql/ivorysql:5.0-bookworm - The same SQL executes correctly on Oracle Database 23c Free (
container-registry.oracle.com/database/free:23.26.0.0-lite), confirming this is valid PL/SQL syntax
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsDone
Activity
jiaoshuntian commentedon Dec 5, 2025
Thank you for reporting this bug
fix: rebuild arg types after package function reordering
test: add regression test for issue IvorySQL#1006
fix: rebuild arg types after package function reordering
test: add subprocedure regression test for issue IvorySQL#1006
fix: rebuild declared_arg_types for subprocedures after arg reordering
test: add regression test for issue IvorySQL#1006
fix: rebuild arg types after package function reordering
test: add subprocedure regression test for issue IvorySQL#1006
fix: rebuild declared_arg_types for subprocedures after arg reordering
test: add regression test for issue IvorySQL#1006
fix: rebuild arg types after package function reordering
test: add subprocedure regression test for issue IvorySQL#1006
fix: rebuild declared_arg_types for subprocedures after arg reordering
test: add regression test for issue IvorySQL#1006
fix: rebuild arg types after package function reordering
test: add subprocedure regression test for issue IvorySQL#1006
fix: rebuild declared_arg_types for subprocedures after arg reordering