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
The server crashes with a segmentation fault when calling ANY function in a PL/iSQL package that contains a private procedure with a local variable initialized directly from a parameter.
The crash occurs even if the problematic procedure is never called - simply having it defined in the package body is enough to trigger the crash when any other function in the package is invoked.
Expected behavior/code
The package should compile and execute without crashing the server. Local variable initialization from parameters is standard PL/SQL syntax and should work correctly.
Steps to reproduce
-
Connect to IvorySQL on the Oracle-compatible port (1521)
-
Create the following package:
CREATE OR REPLACE PACKAGE crash_test IS
FUNCTION get_info RETURN VARCHAR2;
END;
/
CREATE OR REPLACE PACKAGE BODY crash_test IS
-- Private procedure with local variable initialized from parameter
PROCEDURE do_something(p_val IN NUMBER) AS
v_local NUMBER := p_val; -- THIS LINE CAUSES THE CRASH
BEGIN
NULL;
END;
-- Any public function
FUNCTION get_info RETURN VARCHAR2 IS
BEGIN
RETURN 'hello';
END;
END;
/
- Call any function in the package:
SELECT crash_test.get_info();
- Server crashes with "server closed the connection unexpectedly"
Workaround: Initialize local variables to constants, then assign from parameters in the procedure body:
PROCEDURE do_something(p_val IN NUMBER) AS
v_local NUMBER := 0; -- Initialize to constant
BEGIN
v_local := p_val; -- Assign from parameter in body - this works
END;
Additional context that can be helpful for identifying the problem
- The crash occurs during package instantiation/function invocation, not during compilation
- The package compiles successfully without errors
- The problematic procedure does not need to be called - its mere presence in the package body triggers the crash
- The issue appears to be related to how parameter references in variable initializers are resolved during package loading
- This affects any package with this pattern, regardless of package complexity
- 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
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-bookwormOS Version (uname -a)
Linux 6.8.0-87-generic #88-Ubuntu SMP PREEMPT_DYNAMIC x86_64 GNU/Linux
Configuration options (config.status --config)
Current Behavior
The server crashes with a segmentation fault when calling ANY function in a PL/iSQL package that contains a private procedure with a local variable initialized directly from a parameter.
The crash occurs even if the problematic procedure is never called - simply having it defined in the package body is enough to trigger the crash when any other function in the package is invoked.
Expected behavior/code
The package should compile and execute without crashing the server. Local variable initialization from parameters is standard PL/SQL syntax and should work correctly.
Steps to reproduce
Connect to IvorySQL on the Oracle-compatible port (1521)
Create the following package:
Workaround: Initialize local variables to constants, then assign from parameters in the procedure body:
Additional context that can be helpful for identifying the problem
ivorysql/ivorysql:5.0-bookworm(
container-registry.oracle.com/database/free:23.26.0.0-lite), confirming this is valid PL/SQL syntax