Re: PL/PgSQL Boolean Comparison Operator Binding
От | Thomas F.O'Connell |
---|---|
Тема | Re: PL/PgSQL Boolean Comparison Operator Binding |
Дата | |
Msg-id | D7AE87E2-6718-11D9-8CD3-000D93AE0944@sitening.com обсуждение исходный текст |
Ответ на | PL/PgSQL Boolean Comparison Operator Binding (Thomas F.O'Connell <tfo@sitening.com>) |
Список | pgsql-general |
Never mind. I think I had some data that hadn't been calibrated lying around prior to testing. I think my test case was flawed. Sorry for the noise. -tfo -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC http://www.sitening.com/ 110 30th Avenue North, Suite 6 Nashville, TN 37203-6320 615-260-0005 On Jan 15, 2005, at 10:55 AM, Thomas F.O'Connell wrote: > I was recently testing some logic based on columns of type boolean and > noticed some unintuitive behavior in PL/PgSQL. > > I had a construct like the following: > > IF NOT col1 AND NOT col2 THEN ... > > In a scenario where both col1 and col2 were false, this condition was > not triggered. If I rewrote it as: > > IF ( NOT col1 ) AND ( NOT col2 ) THEN ... > > the condition was triggered as expected. > > I would expect NOT to bind more closely than AND. The docs on what > behavior to expect here are pretty sparse in both the Logical > Operators section (9.1) and Expression Evaluation Rules (4.2.11). I > couldn't find anything either confirming or contradicting my > expectations. Also, I didn't try this in standard SQL in a case > construct, but I would assume the behavior would be the same? > > If this is known and expected behavior, what would be the most > appropriate section of the docs for further explanation of order of > evaluation? > > PostgreSQL 7.4.6 on i686-pc-linux-gnu, compiled by GCC 2.95.4. > > -tfo > > -- > Thomas F. O'Connell > Co-Founder, Information Architect > Sitening, LLC > http://www.sitening.com/ > 110 30th Avenue North, Suite 6 > Nashville, TN 37203-6320 > 615-260-0005
В списке pgsql-general по дате отправления: