$1 IS NULL with iso-8859-1 type - Mailing list pgsql-hackers

From Daniele Varrazzo
Subject $1 IS NULL with iso-8859-1 type
Date
Msg-id CA+mi_8ZYoZGXsEBkENULryqbXZ7Cd6kxQiPGtn8GVXxhU_UOCA@mail.gmail.com
Whole thread Raw
Responses Re: $1 IS NULL with iso-8859-1 type
List pgsql-hackers
Hello,

The operator `IS NULL` doesn't work if the argument has unknown type.
In psycopg 3:

    >>> conn.execute("select %s is null", ['foo']).fetchone()
    IndeterminateDatatype: could not determine data type of parameter $1

This can get in the way of using the unknown type for strings (but
specifying the text oid for strings is worse, because there is no
implicit cast from string to most types).

It doesn't seem necessary to specify a type for an argument if it only
has to be compared with null: nullness is independent from the type
and is even specified, in the query parameters, in a separate array
from the parameter values.

Maybe this behaviour can be relaxed?

Cheers

-- Daniele



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Add 64-bit XIDs into PostgreSQL 15
Next
From: Andres Freund
Date:
Subject: Re: pgsql: Prevent instability in contrib/pageinspect's regression test.