Re: syntax pb

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: syntax pb
Дата
Msg-id CAKFQuwZf_jnHZaoA5w7y92MsBVfS8-jpLhfMCGB4_A7+uO7gcQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: syntax pb  (Marc Millas <marc.millas@mokadb.com>)
Ответы Re: syntax pb
Re: syntax pb
Список pgsql-general
On Tue, May 30, 2023 at 8:53 AM Marc Millas <marc.millas@mokadb.com> wrote
 
This comes from a prod environment and even casting NULLs (which is more than strange, BTW) generates absurd errors.

If you want an input to be anything other than plain text (numbers partially exempted) you need to cast it.  Sure, some limited cases allow for other parts of a query to infer untyped literals, but literals defined at the top-level of a SELECT is not one of those places.

Too my understanding it looks like the parser did not parse the select distinct as we think he does.

The DISTINCT clause doesn't really come into play here at all, so if you think it does you indeed have a misunderstanding.
Inputting literal NULLs, and using DISTINCT, are both, IMO, considered code smells and seldom used.  You still need to be able to interpret error messages but if you are running actual queries with these things you may have larger model design and query writing concerns to deal with in addition to being able to identify the problems specific error messages are pointing out and trying to fix them.

David J.

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

Предыдущее
От: Carsten Klein
Дата:
Сообщение: File-Access functions by default not executable by predefined role "pg_read_server_files"
Следующее
От: Tom Lane
Дата:
Сообщение: Re: syntax pb