Re: Consecutive operators not recognized without whitespace
В списке pgsql-general по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Consecutive operators not recognized without whitespace |
| Дата | |
| Msg-id | 14445.1323734478@sss.pgh.pa.us обсуждение |
| Ответ на | Consecutive operators not recognized without whitespace (Chris Angelico <rosuav@gmail.com>) |
| Список | pgsql-general |
Chris Angelico <rosuav@gmail.com> writes:
> 1) Set a bit:
> UPDATE tablename SET flags=flags|8 WHERE id=1234
> 2) Clear a bit:
> UPDATE tablename SET flags=flags&~8 WHERE id=1234
> However, the second statement fails; the Postgres parser tries to find
> a single "&~" operator, instead of using the unary ~ and then the
> binary &. Putting a space between the two symbols makes it work fine,
> but I was wondering: Is this intentional behavior?
Yes. Postgres allows multi-character operator names, so you need a
space in general. There are exceptions for certain single-character
operator names that are defined in the SQL spec (eg, a+-b is required
by spec to parse as two operators), but & and ~ are not in that list.
You can find the details in the fine manual, probably somewhere in
the "Syntax" chapter.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера