Re: "It'd be better if there were not an implicit cast from int8 to text..."

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: "It'd be better if there were not an implicit cast from int8 to text..."
Date: 2007-08-18 16:35:03
Message-ID: 13974.1187454903@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> Hm, I suppose this "kluge" in gram.y for "substr_list" isn't necessary any
> more?

It's still necessary, because if you write

select substring('1234' for '3');

you should get "123", but what you will get without the cast is "3"
because the preferred match will be to substring(text,text).

Also, the original example was from someone who had tried to use a
bigint column for the second parameter. That case would start to draw
ERROR: function pg_catalog.substring(unknown, bigint) does not exist
which doesn't seem helpful, when we know perfectly well that the only
functions this syntax should match take int4.

Probably the comment should be fixed.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Trevor Talbot 2007-08-18 17:01:44 Re: tsearch2 in PostgreSQL 8.3?
Previous Message Bruce Momjian 2007-08-18 16:28:10 Re: tsearch2 in PostgreSQL 8.3?