Re: Problem with || and data types

From: "Peter Darley" <pdarley(at)kinesis-cem(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Pgsql-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problem with || and data types
Date: 2003-05-01 14:31:02
Message-ID: NNEAICKPNOGDBHNCEDCPGEIIDMAA.pdarley@kinesis-cem.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sss(dot)pgh(dot)pa(dot)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(at)kinesis-cem(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mr Mat psql-mail 2003-05-01 14:54:45 Re: Slow Queries with OR's?
Previous Message Tom Lane 2003-05-01 14:22:16 Re: PostgreSQL backup script