Re: Order of SUBSTR and UPPER in statement

From: "T(dot)J(dot) Adami" <adamitj(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Order of SUBSTR and UPPER in statement
Date: 2008-02-18 12:08:09
Message-ID: 68d04b28-90de-4c32-a1fc-744d8a483582@o10g2000hsf.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 13 fev, 12:19, Hermann Muster <Hermann(dot)Mus(dot)(dot)(dot)(at)gmx(dot)de> wrote:
> Hi,
>
> I encountered something I can't really explain. I use the following
> statement in my application:
>
> COALESCE(UPPER(SUBSTR("Y"."Firma",1,7)),'')
>
> This returns "ERROR: syntax error at end of input"
>
> However, using the following statement is fine:
>
> COALESCE(SUBSTR(UPPER("X"."Firma"), 1, 7), '')
>
> The fieldtype of "Firma" is character varying.
>
> The only difference is the order of UPPER and SUBSTR. Is it possible
> that this changed during some PostgreSQL version update? By the way,
> right now I'm using 8.2.
>
> Regards,
> Hermann

Please post the entire SQL statement and table structure, and even
posting here, did you notice in the first SQL you wrote you're using
"Y"."firma", and on the second you typed "X"."firma". Is there any
difference between "X" and "Y" aliases?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marek Lewczuk 2008-02-18 12:14:37 composite type vs table
Previous Message T.J. Adami 2008-02-18 12:02:13 Re: Use index for upper(customername) like 'ABC%'