Skip to content

oracle parser is not switched properly under certain circumstances #760

Closed

Description

@caryhuang

Bug Report

IvorySQL Version

select version();
                                                       version
----------------------------------------------------------------------------------------------------------------------
 PostgreSQL 17.4 (IvorySQL 4.4) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
(1 row)

OS Version (uname -a)

uname -a
Linux synchdb 5.15.0-134-generic #145-Ubuntu SMP Wed Feb 12 20:08:39 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Configuration options ( config.status --config )

using all default configuration

Current Behavior

after a successful switch of ivorysql.compatible_mode from 'pg' to 'oracle', the create command with oracle data type will fail if we have executed and failed a create table command that contains oracle data types before the switch.

Expected behavior/code

after a successful switch of ivorysql.compatible_mode from 'pg' to 'oracle' (via the SET command), the create command with oracle data type shall succeed instead of fail.

Step to reproduce

  1. login with postgresql port number. This causes ivorysql.compatible_mode=pg as default
  2. Once logged in, I ran a CREATE TABLE clause that contains Oracle data type columns, which is expected to fail due to missing oracle data type.
CREATE TABLE IF NOT EXISTS testing ( id numeric NOT NULL DEFAULT NULL , binary_double_col binary_double DEFAULT NULL , binary_float_col binary_float DEFAULT NULL , float_col real DEFAULT NULL , number_col number (10, 2) DEFAULT NULL , long_col long DEFAULT NULL , date_col date DEFAULT NULL , interval_ds_col interval day to second DEFAULT NULL , interval_ym_col interval year to month DEFAULT NULL , timestamp_col timestamp DEFAULT NULL , timestamp_tz_col timestamp with time zone DEFAULT NULL , timestamp_ltz_col timestamp with time zone DEFAULT NULL , char_col char (10) DEFAULT NULL , nchar_col char (10) DEFAULT NULL , nvarchar2_col varchar (50) DEFAULT NULL , varchar_col varchar2 (50) DEFAULT NULL , varchar2_col varchar2 (50) DEFAULT NULL , raw_col raw (100) DEFAULT NULL , bfile_col text DEFAULT NULL , blob_col bytea DEFAULT NULL , clob_col text DEFAULT NULL , nclob_col text DEFAULT NULL , rowid_col text DEFAULT NULL , urowid_col text DEFAULT NULL , PRIMARY KEY(ID));
ERROR:  type "binary_double" does not exist
LINE 1: ...numeric NOT NULL DEFAULT NULL , binary_double_col binary_dou...
                                                             ^
show ivorysql.compatible_mode;
 ivorysql.compatible_mode
--------------------------
 pg
(1 row)
  1. Once failed, I realized the compatible_mode is wrong, so I ran the SET command to change it
postgres=# set ivorysql.compatible_mode=oracle;
SET
  1. After the set, I ran the same query again in which I expect to succeed.
CREATE TABLE IF NOT EXISTS testing ( id numeric NOT NULL DEFAULT NULL , binary_double_col binary_double DEFAULT NULL , binary_float_col binary_float DEFAULT NULL , float_col real DEFAULT NULL , number_col number (10, 2) DEFAULT NULL , long_col long DEFAULT NULL , date_col date DEFAULT NULL , interval_ds_col interval day to second DEFAULT NULL , interval_ym_col interval year to month DEFAULT NULL , timestamp_col timestamp DEFAULT NULL , timestamp_tz_col timestamp with time zone DEFAULT NULL , timestamp_ltz_col timestamp with time zone DEFAULT NULL , char_col char (10) DEFAULT NULL , nchar_col char (10) DEFAULT NULL , nvarchar2_col varchar (50) DEFAULT NULL , varchar_col varchar2 (50) DEFAULT NULL , varchar2_col varchar2 (50) DEFAULT NULL , raw_col raw (100) DEFAULT NULL , bfile_col text DEFAULT NULL , blob_col bytea DEFAULT NULL , clob_col text DEFAULT NULL , nclob_col text DEFAULT NULL , rowid_col text DEFAULT NULL , urowid_col text DEFAULT NULL , PRIMARY KEY(ID));
ERROR:  type "long" does not exist
LINE 1: ...number_col number (10, 2) DEFAULT NULL , long_col long DEFAU...

show ivorysql.compatible_mode;
 ivorysql.compatible_mode
--------------------------
 oracle
(1 row)

  1. Instead of succeeding, it complains about another data type not exist and thus the issue.

Additional context that can be helpful for identifying the problem

if we set ivorysql.compatible_mode=oracle before running any create table command, then it will work fine.

Activity

  1. added
    bug
    on Mar 25, 2025
  2. changed the title [-]oracle parse is not switched properly under certain operations[/-] [+]oracle parser is not switched properly under certain circumstances[/+] on Mar 25, 2025
  3. bigplaice commented on Mar 27, 2025

    @bigplaice
    Collaborator

    Thanks for reporting this issue, Cary!
    I have successfully reproduced it and investigation is in progress.

  4. moved this to In Progress in IvorySQL 4on Mar 28, 2025
  5. added this to IvorySQL 4.5 and removed this from IvorySQL 4on Jun 4, 2025
  6. closed this as completedby moving to Done in IvorySQL 4.5on Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions