Comments (6)
This is not a misconfiguration or a bug, this is the PostgreSQL representation of boolean in COPY output. You will have t for true and f for false. In INSERT statement you will have 't' and 'f'.
Regards
from ora2pg.
Hi Darold,
Thank you for your answer but we misunderstand each other..
I understand that the t represent a true but I don't understand why ALL the rows get a t while some of them should get a f...
from ora2pg.
OK, sorry for the misunderstanding. If REPLACE_AS_BOOLEAN is a list of table_name:column_name there's no misconfiguration. The only things is that you don't need to add 1:0 to BOOLEAN_VALUES as it is defined per default.
I don't see any bug in the code, what version of Ora2Pg are you using ?
from ora2pg.
I'm using ora2pg-11.4 with an Oracle 10.2g
I'm doing a oracle->file migration and then loading these to postgresql with psql.
Could it make a difference if I copy directly to postgresql?
Here is an example:
Oracle DDL:
CREATE TABLE "TRUNK"."AM"
( "ENHED_ID" NUMBER(10,0) CONSTRAINT "AM_ENHED_ID_C" NOT NULL ENABLE,
"ANTAL" NUMBER(5,0) DEFAULT 0 CONSTRAINT "AM_ANTAL_C" NOT NULL ENABLE,
"ANTALBOOKED" NUMBER(5,0) DEFAULT 0 CONSTRAINT "AM_ANTALBOOKED_C" NOT NULL ENABLE,
"DATO" DATE CONSTRAINT "AM_DATO_C" NOT NULL ENABLE,
"LUKKET" NUMBER(1,0) DEFAULT 0 CONSTRAINT "AM_LUKKET_C" NOT NULL ENABLE,
"BR_MINDAGE" NUMBER(3,0) DEFAULT 1 CONSTRAINT "AM_BR_MINDAGE_C" NOT NULL ENABLE,
"MANUELPRIS" NUMBER(6,2),
"BR_ANKOMSTTILLADT" NUMBER(1,0) DEFAULT 1 CONSTRAINT "AM_BR_ANKOMSTTILLADT_C" NOT NULL ENABLE,
"BR_MAXDAGE" NUMBER(3,0),
"BR_AFREJSETILLADT" NUMBER(1,0) DEFAULT 1 CONSTRAINT "AM_BR_AFREJSETILLADT_C" NOT NULL ENABLE,
CONSTRAINT "AM_PK" PRIMARY KEY ("ENHED_ID", "DATO") ENABLE,
CONSTRAINT "AM_CHK1" CHECK (
antal >= antalbooked
);
Postgresql DDL:
CREATE TABLE am
(
enhed_id integer NOT NULL,
antal integer NOT NULL DEFAULT 0,
antalbooked integer NOT NULL DEFAULT 0,
dato timestamp without time zone NOT NULL,
lukket boolean NOT NULL DEFAULT false,
br_mindage integer NOT NULL DEFAULT 1,
manuelpris real,
br_ankomsttilladt boolean NOT NULL DEFAULT true,
br_maxdage integer,
br_afrejsetilladt boolean NOT NULL DEFAULT true,
CONSTRAINT am_pkey PRIMARY KEY (enhed_id, dato),
CONSTRAINT am_chk1 CHECK (antal >= antalbooked)
)
From ora2pg:
REPLACE_AS_BOOLEAN am:br_ankomsttilladt am:br_afrejsetilladt am:lukket
Data in oracle:
"ENHED_ID" "ANTAL" "ANTALBOOKED" "DATO" "LUKKET" "BR_MINDAGE" "MANUELPRIS" "BR_ANKOMSTTILLADT" "BR_MAXDAGE" "BR_AFREJSETILLADT"
"1032" "10" "3" "01-JAN-11 00:00" "0" "1" "" "1" "" "1"
"1032" "10" "3" "02-JAN-11 00:00" "0" "1" "" "1" "" "1"
"1032" "10" "4" "03-JAN-11 00:00" "0" "1" "" "1" "" "1"
"1032" "10" "1" "04-JAN-11 00:00" "0" "1" "" "1" "" "1"
"1032" "10" "1" "05-JAN-11 00:00" "0" "1" "" "1" "" "1"
"1032" "10" "1" "06-JAN-11 00:00" "0" "1" "" "1" "" "1"
"1032" "10" "0" "07-JAN-11 00:00" "0" "1" "" "1" "" "1"
"1032" "10" "0" "08-JAN-11 00:00" "0" "1" "" "1" "" "1"
"1032" "10" "0" "09-JAN-11 00:00" "0" "1" "" "1" "" "1"
Data in copy:
COPY am (enhed_id,antal,antalbooked,dato,lukket,br_mindage,manuelpris,br_ankomsttilladt,br_maxdage,br_afrejsetilladt) FROM STDIN;
1032 10 3 2011-01-01 00:00:00 t 1 \N t \N t
1032 10 3 2011-01-02 00:00:00 t 1 \N t \N t
1032 10 4 2011-01-03 00:00:00 t 1 \N t \N t
1032 10 1 2011-01-04 00:00:00 t 1 \N t \N t
1032 10 1 2011-01-05 00:00:00 t 1 \N t \N t
1032 10 1 2011-01-06 00:00:00 t 1 \N t \N t
1032 10 0 2011-01-07 00:00:00 t 1 \N t \N t
1032 10 0 2011-01-08 00:00:00 t 1 \N t \N t
1032 10 0 2011-01-09 00:00:00 t 1 \N t \N t
As you can see "lukket" is false for all of the rows in oracle but has a t in copy.
As stated earlier I get the same result for the text fields containing True:False and ja:nej.
from ora2pg.
Thanks a lot Christian, your example helped a lot to find the bug. It is fixed now with commit 5edc4e5. Please download latest development code and give it a try.
Best regards,
from ora2pg.
That worked :)
Thank you!
from ora2pg.
Related Issues (20)
- Bug Issue migrating data in json column (like https://github.com/darold/ora2pg/issues/1745) HOT 1
- lo_import _table_name.sh script issue
- geometry wrongly exported when there is a "hole" in the geometry
- Mysql migration HOT 1
- Migrating From SQL Server to Postgres with Ora2pg Is very Slow HOT 1
- Request for sha256sum on downloads HOT 1
- Config option to override the NLS_TIMESTAMP_FORMAT or such encoding parameters used by Ora2pg HOT 1
- Invalid check constraint conversion to PostgreSQL format while exporting schema from Oracle HOT 1
- OUT OF MEMORY EVEN THOUGH SERVER HAS OVER 16GB FREE RAM HOT 2
- [ORACLE]Slow export of BLOB and CLOB from HOT 7
- Reading the ora2pg assessment report HOT 6
- Mysql to postgresql migration HOT 9
- ERROR : DBI::db=HASH(0x29c1784f2e8)->disconnect invalidates 1 active statement handle HOT 3
- Wrong argument "extra_param OPAQUE" in function with OUT arguments (regression in release 24.3) HOT 1
- Wrong change in translation of "is not null" clause (regression in release 24.3) HOT 1
- Extract data query errorring out HOT 6
- Oracle column aliases (after TRIM function) are syntactically incorrect due to small bug introduced in commit 66f4fc37 HOT 1
- Issue in migrating from SQL Server to CloudSQL Postgres HOT 4
- Foreign server always generated with default port HOT 3
- Export data with CLOB is too slow HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ora2pg.