Re: Odd results in SELECT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>
Cc: Philip Warner <pjw(at)rhyme(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Odd results in SELECT
Date: 2001-05-11 13:53:14
Message-ID: 4265.989589194@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

See my prior reply to Philip: the problem is that the given string is
longer than NAMEDATALEN. When you write
rulename = 'foo'
(rulename is of type NAME) the untyped literal string 'foo' gets coerced
to NAME, ie truncated to fit, and all is well. When you write
rulename = ('foo' || 'bar')
the result of the || operator is type TEXT, so instead rulename is
converted to TEXT and a text comparison is performed. In this case the
righthand value is not truncated and so the match will always fail.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Roberto Mello 2001-05-11 15:06:05 Re: [HACKERS] Problems in porting from Oracle to Postgres
Previous Message Tom Lane 2001-05-11 13:44:02 Re: Converting PL/SQL to PL/PGSQL