credativ / informix_fdw

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

DirectFunctionCall varcharin #23

Closed ghost closed 5 years ago

ghost commented 5 years ago

Looking at the implementation of varcharin in the PostgreSQL source tree, it looks as if the function takes three arguments:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/utils/adt/varchar.c;h=8f07b1e2729b3a611fcda4f2955e9afb0e7f24af;hb=HEAD#l486

Where it is being used in this FDW, it is being called with two arguments:

https://github.com/credativ/informix_fdw/blob/3afb89d8bff9a38c988d7da89e3d1133fe3aeb3b/ifx_conv.c#L2299 https://github.com/credativ/informix_fdw/blob/3afb89d8bff9a38c988d7da89e3d1133fe3aeb3b/ifx_conv.c#L2331

I believe changing the calls to DirectFunctionCall3 and adding a middle argument of InvalidOid will be sufficient to avoid trouble since the middle argument is not used.

psoo commented 5 years ago

This is indeed an oversight and also applies to any other type input routine with typemods (e.g. numeric_in() and timestamp_in()). Will fix.

psoo commented 5 years ago

Fix committed. Thanks for the report!