mongo_fdw icon indicating copy to clipboard operation
mongo_fdw copied to clipboard

Fix bug of mongo_fdw in Mar-2022

Open khieuvm opened this issue 2 years ago • 3 comments

We have fix 2 bugs of your repository. I'd like to create a PR to contribute them to your repository.

khieuvm avatar Mar 29 '22 07:03 khieuvm

On Tue, Mar 29, 2022 at 1:19 PM Vu Manh Khieu @.***> wrote:

We have fix 2 bugs of your repository. I'd like to create a PR to contribute them to your repository.

Why do you think that UTF8 bson type should be mapped to the name type at the PostgreSQL side? Can you please explain the same?

We map UTF8 bson type to TEXT type which seems more correct.

We can't assign a > int32 value to an int32 variable. And thus throwing an error is the correct way. Storing a wrong overflow value is NOT good.


You can view, comment on, or merge this pull request online at:

https://github.com/EnterpriseDB/mongo_fdw/pull/159 Commit Summary

File Changes

(4 files https://github.com/EnterpriseDB/mongo_fdw/pull/159/files)

Patch Links:

  • https://github.com/EnterpriseDB/mongo_fdw/pull/159.patch
  • https://github.com/EnterpriseDB/mongo_fdw/pull/159.diff

— Reply to this email directly, view it on GitHub https://github.com/EnterpriseDB/mongo_fdw/pull/159, or unsubscribe https://github.com/notifications/unsubscribe-auth/APOVKLPJVS4BS5BBBYTTCMLVCKYXVANCNFSM5R5QUFUA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Jeevan Chalke

Senior Staff SDE, Database Architect and Manager,Product Development

edbpostgres.com

jeevanchalke avatar Mar 29 '22 08:03 jeevanchalke

Why do you think that UTF8 bson type should be mapped to the name type at the PostgreSQL side? Can you please explain the same?

Following the commit log, when I debug with name type, your code does not process if type is UTF8. You can reprocedure it follow my commit log.

We can't assign a > int32 value to an int32 variable. And thus throwing an error is the correct way.

We get value by: int64 val = bson_iter_int64(it);, so I think we need to compare it with INT64 type, why we compare it with INT32 type?

khieuvm avatar Mar 29 '22 08:03 khieuvm

On Tue, Mar 29, 2022 at 2:09 PM Vu Manh Khieu @.***> wrote:

Why do you think that UTF8 bson type should be mapped to the name type at the PostgreSQL side? Can you please explain the same?

Following the commit log, when I debug with name type, your code does not process if type is UTF8. You can reprocedure it follow my commit log.

Yes. The name type is mapped ONLY with ObjectId BSON type and UTF8 BSON type is mapped to TEXT type. So you need to define a foreign table with text type if you have UTF8 data on the mongo side. Supporting such cross types needs a detailed study and not just allowing utf8 data with name.

We can't assign a > int32 value to an int32 variable. And thus throwing an error is the correct way.

We get value by: int64 val = bson_iter_int64(it);, so I think we need to compare it with INT64 type, why we compare it with INT32 type?

The foreign table column type is int32. How can you store value greater than int32 into it?

— Reply to this email directly, view it on GitHub https://github.com/EnterpriseDB/mongo_fdw/pull/159#issuecomment-1081592560, or unsubscribe https://github.com/notifications/unsubscribe-auth/APOVKLOA4Q2CZLOWIYDWXQ3VCK6UFANCNFSM5R5QUFUA . You are receiving this because you commented.Message ID: @.***>

-- Jeevan Chalke

Senior Staff SDE, Database Architect and Manager,Product Development

edbpostgres.com

jeevanchalke avatar Oct 11 '22 08:10 jeevanchalke