Re: Operator Precedence problem?
От | Tom Lane |
---|---|
Тема | Re: Operator Precedence problem? |
Дата | |
Msg-id | 22816.966095790@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Operator Precedence problem? (Philip Warner <pjw@rhyme.com.au>) |
Список | pgsql-sql |
Philip Warner <pjw@rhyme.com.au> writes: > Which makes me think that the precedence of 'or' is not what I > expected. OR is certainly lower-precedence than AND --- this is hard-wired in the grammar and not subject to change across databases. It's also required by SQL92: <search condition> ::= <boolean term> | <search condition> OR <boolean term> <boolean term> ::= <boolean factor> | <boolean term> AND <boolean factor> <boolean factor> ::= [ NOT ] <boolean test> <boolean test> ::= <boolean primary> [ IS [ NOT ] <truth value> ] <truth value> ::= TRUE | FALSE | UNKNOWN <boolean primary> ::= <predicate> | <left paren> <search condition> <right paren> BTW, I notice that we do not correctly implement the IS tests. The parser turns them into "<primary> = 't'::bool" and so on, which is wrong because it will yield NULL for NULL input, which is contrary to the spec for these tests. We need specialized functions comparable to the ones for IS NULL (in fact, IS UNKNOWN should be equivalent to IS NULL except for requiring a boolean input, AFAICT). regards, tom lane
В списке pgsql-sql по дате отправления: