credativ / informix_fdw

Foreign Data Wrapper for Informix Databases
Other
28 stars 5 forks source link

Comment: could not convert informix character type into pg type 23 #15

Closed rossj-cargotel closed 7 years ago

rossj-cargotel commented 8 years ago

This error message will appear if the table definition differs on the informix side from the definition used to create the foreign table.

I got this when I created a foreign table from our production database and tried to use that to query the same table on a foreign server pointed at our development informix server.

psoo commented 8 years ago

Agreed, here's something fishy going on. Could you post

a) the definition of the source table

and

b) the definition of the target table IMPORT FOREIGN SCHEMA has created for you. That should help to track down this issue.

The ERROR is coming from this part of the source:

        /*
         * At this point we never expect a NULL datum without
         * having retrieved NULL from informix. Check it.
         * If it's a validated NULL value from informix,
         * don't throw an error.
         */
        if ((DatumGetPointer(dat) == NULL)
            && !*isnull)
        {
            ifxRewindCallstack(&state->stmt_info);
            elog(ERROR, "could not convert informix character type into pg type %u",
                 PG_ATTRTYPE_P(state, attnum));
        }

So i suspect something is going wrong in convertIfxCharacterString(), which does all the legwork before this error condition.

psoo commented 8 years ago

Please see the branch better_pushdown_handling for a commit which adresses this. On reflection, this is not a bug, but a not very clear error message telling you that you have an incompatible type mapping somewhere in a table column. Commit https://github.com/credativ/informix_fdw/commit/51c92c6a0272f293633848bffac0c3daef29f595 adds a more verbose error message to indicate this error.

psoo commented 7 years ago

Related patch merged into master, so i'm closing this.