Re: 7.1.2 release

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 7.1.2 release
Date: 2001-05-11 05:28:22
Message-ID: 2600.989558902@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
> Yes - it's waiting on the problem Zoltan reported (the select from
> pg_rewrite etc). I can't reproduce the problem on any of my DBs.

I've just realized that the problem is a lot simpler than it appears.
The given string is too long for a NAME:

regression=# select ('_RET' || 'szallitolevel_tetele_ervenyes')::name;
?column?
---------------------------------
_RETszallitolevel_tetele_erveny
(1 row)

When you write

select oid from pg_rewrite where
rulename='_RETszallitolevel_tetele_ervenyes'

the unknown-type literal is coerced to NAME --- ie truncated --- and
then the comparison works. But when you write

select oid from pg_rewrite where
rulename='_RET' || 'szallitolevel_tetele_ervenyes'

the result of the || will be type TEXT not type NAME. So the rulename
gets promoted to TEXT and texteq is used ... with the result that
_RETszallitolevel_tetele_ervenye does not match
_RETszallitolevel_tetele_ervenyes.

Solution: don't use ||, or explicitly cast its result to NAME:

select oid from pg_rewrite where
rulename=('_RET' || 'szallitolevel_tetele_ervenyes')::name

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit 2001-05-11 06:54:25 Problems in porting from Oracle to Postgres
Previous Message Martín Marqués 2001-05-11 05:19:24 Re: 7.2 items