Re: BUG #4939: error query result - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4939: error query result
Date
Msg-id 25836.1248441905@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #4939: error query result  (Greg Stark <gsstark@mit.edu>)
List pgsql-bugs
Greg Stark <gsstark@mit.edu> writes:
> On Fri, Jul 24, 2009 at 6:02 AM, Tom Lane<tgl@sss.pgh.pa.us> wrote:
>> I think the only thing we could do about it is downgrade the implicit
>> casts to "name", which seems like a cure worse than the disease ---
>> it'd interfere with searches in the system catalogs.

> We could try to avoid user-visible functions like current_user
> returning "name" data types.

Only if you want to break system catalog searches.  Example:

regression=# explain select * from pg_class where relname = 'foo';
                                         QUERY PLAN

--------------------------------------------------------------------------------
-------------
 Index Scan using pg_class_relname_nsp_index on pg_class  (cost=0.00..8.27 rows=
1 width=185)
   Index Cond: (relname = 'foo'::name)
(2 rows)

regression=# explain select * from pg_class where relname = 'foo'::text;
                        QUERY PLAN
-----------------------------------------------------------
 Seq Scan on pg_class  (cost=0.00..30.87 rows=3 width=185)
   Filter: ((relname)::text = 'foo'::text)
(2 rows)

If we do what you suggest, and don't want to take the above hit, we
would have to make name be a preferred type, which would *definitely*
create a bunch of problems.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: BUG #4938: upgrade to 8.4 issue
Next
From: ""
Date:
Subject: BUG #4941: pg_stat_statements crash