Skip to content

Handling Single-Line Comments in Table DDL #1905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

newtora2pg
Copy link
Contributor

Problem:
In Oracle table DDL, when single-line comments (--) are used after columns, Ora2Pg places commas after the comments.
This causes syntax errors in the converted PostgreSQL DDL. This occurs when fetching from source db.

Example:

Oracle Input:
CREATE TABLE employees (
employee_id NUMBER PRIMARY KEY,
first_name VARCHAR2(50) -- fname
,
last_name VARCHAR2(50) -- lname
,
hire_date DATE
);

Incorrect Ora2Pg Output:
CREATE TABLE employees (
employee_id INTEGER PRIMARY KEY,
first_name VARCHAR(50) -- fname,
last_name VARCHAR(50) -- lname,
hire_date DATE
);

Solution:
Updated logic to detect single-line comments during DDL reconstruction. Ensured that commas are placed before comments or moved to the next line if needed. Prevented syntax issues in PostgreSQL due to misplaced commas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant