8.1 substring bug?

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

Consider the following:

CREATE TEMP TABLE tbl (
id SERIAL NOT NULL,
PRIMARY KEY (id)
);

COPY tbl (id) FROM stdin;
1
2
3
4
\.

SELECT substring ('1234567890' FOR (SELECT count (*) FROM tbl)::int);

This returns '1234', as expected. But

SELECT substring ('1234567890' FOR (SELECT count (*) FROM tbl));

returns NULL. I think the problem is that "SELECT count(*)" returns a
BIGINT whereas "substring" expects an INT. Shouldn't there be a warning?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2005-11-11 13:50:58 Re: 8.0 -> 8.1 dump duplicate key problem?
Previous Message huaxin zhang 2005-11-11 13:37:07 Re: Getting table name/tuple from OID