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