-
Notifications
You must be signed in to change notification settings - Fork 153
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
Empty DATE fields cannot be retrieved #90
Comments
It works here (on 32-bit Windows and Linux) with the latest version from git, and I don't think that has changed since 1.4.0. In Oracle:
In PostgreSQL:
NULLs should come across as NULLs.
|
Thanks for the quick answer! While during your tests, I found out that it doesn't fail on records with NULL values, it failes on some records which even have a date value. Here is a describe of the Oracle table:
Note sure how you do it for postgresql, I just ran:
and got
So MDSYS.SDO_GEOMETRY for Oracle and "text" in postgresql, using the IMPORT FOREIGN SCHEMA; I tried your lines and it worked. I also tried creating the FOREIGN table with the type "timestamp(0) without time zone" instead of date but it also works. For your last questions, I ran this query in sqlplus:
and got a count of 643, so the lines have null dates. But it turns out that selectind a row which has a valid date value:
Also brings out the same error Couple of question:
But there is no AD / BC in my database just dates like "30/11/02". So maybe there is a confusion between time and date? Like my dates don't have a time so extraction goes wrong? I am trying to find a better way to reproduce this |
IMPORT FOREIGN SCHEMA maps Oracle DATE to "timestamp(0) without time zone" because Oracle dates have a time part, so this is the best mapping. I guess that the problem you observe is due to the fact that the Oracle DATEs are NOT NULL, but look like 0000-00-00. PostgreSQL will correctly reject such a date. To solve this it would be important to know what really is in these DATE columns. Try the following Oracle query:
where the WHERE clause identifies one of the rows with 0000-00-00. That will help me figure out what is in those columns. |
Again, thanks a lot for your help on this :)
Hopefully, it makes sense to you ! |
Here is a good description of what the internal representation means. In your case that should be: year 3636 before Christ, month 0, day 0 at midnight. So I'd say you got corrupt data in your Oracle database. How did those strange values get there? |
Well I imported a dump from a customer's database into my own oracle installation, maybe something messed up in between. |
Sure. |
I'll leave a comment if I ever find out. And again, thanks a lot for your help/patience ! |
Hello,
First of all, thanks a lot for your work on this project, it is incredibly useful :)
I am running latest PG 9.5 (9.5.3), using oracle_fdw-1.4.0-pg95-win64 that I downloaded from Github, with Oracle instantclient-basic-windows.x64-12.1.0.2.0. This is all running on my machine on Windows 10 64-Bits.
I successfully used IMPORT FOREIGN SCHEMA but when I try to select one of the tables, I get the following error:
Means (in french) that the value is out of date/time bounds.
The field of type DATE, nullable. And it does indeed contain some null values:
I looked at the issues and found some related to date encoding but fixed in the 1.4.0 changelog.
I think it might be related to the fact that the value is null and not considered null during the "transfer" or something.
Thanks for your help,
Fabien
The text was updated successfully, but these errors were encountered: