Oracle Compatible Empty String to NULL
1. Purpose
-
In IvorySQL’s Oracle compatibility mode, support converting empty strings to NULL for storage, providing behavior consistent with Oracle Database.
2. Feature Description
-
Oracle compatibility mode supports converting empty strings to NULL for storage.
-
The feature is controlled by parameter
ivorysql.enable_emptystring_to_null, with default valueon. -
When this parameter is enabled, inserting an empty string will automatically convert it to NULL value for storage.
-
NULL values after conversion can be queried using the
IS NULLcondition.
3. Test Cases
-- Create test table
ivorysql=# create table abc (id int);
CREATE TABLE
-- Check empty string to NULL parameter status
ivorysql=# show ivorysql.enable_emptystring_to_null;
ivorysql.enable_emptystring_to_NULL
-------------------------------------
on
(1 row)
-- Insert empty string
ivorysql=# insert into abc values('');
INSERT 0 1
-- Query table data, displays as NULL
ivorysql=# select * from abc;
id
\----
(1 row)
-- Query using IS NULL condition
ivorysql=# select * from abc where id is null;
id
\----
(1 row)