darold / ora2pg

Ora2Pg is a free tool used to migrate an Oracle database to a PostgreSQL compatible schema. It connects your Oracle database, scan it automatically and extracts its structure or data, it then generates SQL scripts that you can load into PostgreSQL.
http://www.ora2pg.com/
GNU General Public License v3.0
978 stars 341 forks source link

psql:./schema/tables/table.sql:625: ERROR: syntax error at or near what -- missing comma #1721

Closed kkettinger closed 4 months ago

kkettinger commented 6 months ago

After export_schema.sh, i'm trying to import the schema into the postgresql database. It seems for the table.sql export, there are missing commas directly before a comment.

See this table for example:

CREATE TABLE test(
    proz_id bigint,
    zeitstempel timestamp(0) DEFAULT statement_timestamp()
-- Prozessname,
    what varchar(100),
    elasped bigint,
    add_info varchar(300),
    startstopp smallint DEFAULT 1,
    id bigint NOT NULL
) ;

After statement_timestamp(), there is a comma missing.

Command with output:

./import_all.sh -h postgres -s -U postgres -d test -o postgres -y
...
Running: psql --single-transaction  -h postgres -U postgres -d test -f ./schema/tables/table.sql
..
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
psql:./schema/tables/table.sql:614: ERROR:  syntax error at or near ""what""
LINE 5:  what varchar(100),
         ^
ERROR: an error occurs when importing file ./schema/tables/table.sql.

Postgres Client Version: psql (PostgreSQL) 16.1 (Debian 16.1-1.pgdg110+1) Postgres Server Version: psql (PostgreSQL) 16.1 (Debian 16.1-1.pgdg120+1) Ora2PG Version: v24.1

darold commented 5 months ago

It look like you have comment in the Oracle default value for this column. This should be very rare, but I will try to remove them automatically.

darold commented 4 months ago

Not reproducible, however this should be a very rare case, there is more priorities, closing.