Thread: Bug report - ODBC Driver - Error 42P18

Bug report - ODBC Driver - Error 42P18

From
Consolity Inc
Date:
The PostgreSQL ANSI ODBC driver reports 42P18 - ERROR: could not determine data type of parameter $<n>; when preparing SQL with an expression of the form:

<bound parameter> IS NULL.

This is a breaking change to existing code that depends on being able to check the NULL-ness of a parameter.

Behavior is new as of psqlODBC 09.03.0100

PostgreSQL version: 9.3.2
OS: Windows


Re: Bug report - ODBC Driver - Error 42P18

From
Adrian Klaver
Date:
On 02/28/2014 08:20 AM, Consolity Inc wrote:
> The PostgreSQL ANSI ODBC driver reports 42P18 - ERROR: could not
> determine data type of parameter $<n>; when preparing SQL with an
> expression of the form:
>
> <bound parameter> IS NULL.
>
> This is a breaking change to existing code that depends on being able to
> check the NULL-ness of a parameter.
>
> Behavior is new as of psqlODBC 09.03.0100

There is a bug fix to the above version:

http://psqlodbc.projects.pgfoundry.org/docs/release.html

Not sure if that covers the error or not.

>
> PostgreSQL version: 9.3.2
> OS: Windows
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Bug report - ODBC Driver - Error 42P18

From
Heikki Linnakangas
Date:
On 02/28/2014 06:20 PM, Consolity Inc wrote:
> The PostgreSQL ANSI ODBC driver reports 42P18 - ERROR: could not determine data type of parameter $<n>; when
preparingSQL with an expression of the form: 
> <bound parameter> IS NULL.
> This is a breaking change to existing code that depends on being able to check the NULL-ness of a parameter.
> Behavior is new as of psqlODBC 09.03.0100

The default for UseServerSidePrepare changed in 09.03.0100. Maybe it's
because of that? You can try setting UseServerSidePrepare=0 to get the
old behavior.

I would recommend modifying the query to explicitly cast the parameter,
though. Something like "?::text IS NULL" should work.

- Heikki