Re: 8.1 substring bug?

From: Harald Fuchs <hf0923x(at)protecting(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: 8.1 substring bug?
Date: 2005-11-11 14:57:39
Message-ID: 87veyz44gs.fsf@srv.protecting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In article <20051111141232(dot)GH13177(at)svana(dot)org>,
Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:

> It's even sillier than that:
> test=# SELECT substring ('1234567890' FOR 4::bigint);
> substring
> -----------

> (1 row)

> test=# SELECT substring ('1234567890' FOR 4::int);
> substring
> -----------
> 1234
> (1 row)

> Looking at the explain verbose make it look like it's using the wrong
> version of substring. It's using the oid 2074 one:

> test=# select oid, oid::regprocedure from pg_proc where proname =
> 'substring';
> oid | oid
> -------+-------------------------------------
> 936 | "substring"(text,integer,integer)
> 937 | "substring"(text,integer)
> 1680 | "substring"(bit,integer,integer)
> 1699 | "substring"(bit,integer)
> 2012 | "substring"(bytea,integer,integer)
> 2013 | "substring"(bytea,integer)
> 2073 | "substring"(text,text)
> 2074 | "substring"(text,text,text) <----
> 16579 | "substring"(citext,integer,integer)
> 16580 | "substring"(citext,integer)
> (10 rows)

> That substring is for regular expressions. Nasty, not sure how to deal
> with that one...

Ah, so it's using "substring (STRING from PATTERN for ESCAPE)"?
Yes, that explains the NULL. Looks like we're in the INT/BIGINT
confusion again...

> Have a nice day,

It's a nice day since I have a nice workaround for this misfeature :-)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matteo Beccati 2005-11-11 15:00:54 Re: Does EXPLAIN ANALYZE show a wrong plan for MIN/MAX?
Previous Message Tom Lane 2005-11-11 14:49:17 Re: Does EXPLAIN ANALYZE show a wrong plan for MIN/MAX?