Philip Warner <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl

Reply via email to