Re: $1 IS NULL with iso-8859-1 type

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: $1 IS NULL with iso-8859-1 type
Дата
Msg-id 3263809.1669060965@sss.pgh.pa.us
обсуждение исходный текст
Ответ на $1 IS NULL with iso-8859-1 type  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список pgsql-hackers
Daniele Varrazzo <daniele.varrazzo@gmail.com> writes:
> The operator `IS NULL` doesn't work if the argument has unknown type.
> conn.execute("select %s is null", ['foo']).fetchone()
>     IndeterminateDatatype: could not determine data type of parameter $1

Yeah.

> 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.

True, the IS NULL operator itself doesn't care about the data type,
but that doesn't mean that noplace else in the system does.

As an example, if we silently resolved the type as "text" as you seem
to wish, and then the client sends a non-null integer in binary format,
we'll likely end up throwing a bad-encoding error.

Maybe that's not a big problem, I dunno.  But we can't just not
resolve the type, we have to pick something.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: Prevent instability in contrib/pageinspect's regression test.
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Cleanup: Duplicated, misplaced comment in HeapScanDescData