Re: Problem with || and data types

Поиск
Список
Период
Сортировка
От Peter Darley
Тема Re: Problem with || and data types
Дата
Msg-id NNEAICKPNOGDBHNCEDCPGEIIDMAA.pdarley@kinesis-cem.com
обсуждение исходный текст
Ответ на Re: Problem with || and data types  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom and Bijoy,
    The parentheses was the answer.
    I was under the impression that this was working in 7.2.1 because I had
forgotten that I was making some refinements to my application as I was
testing it with the new version of PostgreSQL.  You are right, of course, it
doesn't work in 7.2.1 without the parentheses.
    So, everyone, let me be a lesson to you.  Only change one thing at a time
or else you'll get confused and look stupid.
Thanks,
Peter Darley

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Wednesday, April 30, 2003 6:34 PM
To: Peter Darley
Cc: Pgsql-General
Subject: Re: [GENERAL] Problem with || and data types


"Peter Darley" <pdarley@kinesis-cem.com> writes:
> ... AND Import_Items.Name <>(SELECT QT.Import_As FROM
> Question_Types QT, Border_Type_Translation BTT WHERE
QT.Value=BTT.First_Type
> AND BTT.Second_Type=Border_Questions.Type) || ':' ||
> Border_Questions.Field_Name

Actually, the first operator you have there is "<>" not "=".  "<>" is
considered a generic Op, just like "||", so the binding will be left-to-
right.  AFAIK this was the same in 7.2 and for a good ways before.

In short, you need some parentheses.

            regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PostgreSQL backup script
Следующее
От: Mr Mat psql-mail
Дата:
Сообщение: Re: Slow Queries with OR's?