Odp: Re: BUG #5035: cast 'text' to 'name' doesnt work in plpgsqlfunction - Mailing list pgsql-bugs

From Tomasz Karlik
Subject Odp: Re: BUG #5035: cast 'text' to 'name' doesnt work in plpgsqlfunction
Date
Msg-id 4AA4C43D0200002D0000321B@mars.ultimo.pl
Whole thread Raw
In response to Re: BUG #5035: cast 'text' to 'name' doesnt work in plpgsql function  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: BUG #5035: cast 'text' to 'name' doesnt work in plpgsqlfunction  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-bugs
>>> Alvaro Herrera <alvherre@commandprompt.com> 9/4/2009 7:23 PM >>>
tkarlik@ultimo.pl wrote:

> Without casting function executes much slower:
>
> CREATE OR REPLACE FUNCTION table_exists(tblname text) RETURNS boolean AS '
> DECLARE
> exists boolean;
> BEGIN
>     SELECT 1 INTO exists FROM pg_class WHERE relname =3D name($1);
>     RETURN exists;
> END;
> ' LANGUAGE 'plpgsql' IMMUTABLE;

If you're looking for a speedy answer, try a SQL function, not plpgsql.
=20


The same issue when using SQL function... However other casting (for exampl=
e int4->int8) works properly.

pgsql-bugs by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: BUG #5038: WAL file is pending deletion in pg_xlog folder, this interferes with WAL archiving.
Next
From: Pavel Stehule
Date:
Subject: Re: BUG #5035: cast 'text' to 'name' doesnt work in plpgsqlfunction