I wrote:
Martijn van Oosterhout kleptog@svana.org writes:
In this particular case the syntax makes it unclear that the substring
is the problem. Perhaps here the solution would be to put a cast in the
grammer, like so:
...
But I think we could do this in substr_list in the case where we have
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'
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
Martijn van Oosterhout kleptog@svana.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)
This has been complained of
On Fri, 11 Nov 2005, Tom Lane wrote:
Martijn van Oosterhout kleptog@svana.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
---
Stephan Szabo [EMAIL PROTECTED] writes:
It looks to me like we should be supporting any exact numeric with scale 0
there (at least AFAICS from SQL92 and SQL03), so I don't think the current
behavior is compliant. It doesn't look like adding a numeric overload
of the function works, and the
Martijn van Oosterhout kleptog@svana.org writes:
In this particular case the syntax makes it unclear that the substring
is the problem. Perhaps here the solution would be to put a cast in the
grammer, like so:
substr_for: FOR a_expr { $$ =3D
makeTypeCast($2,int4); }
On Fri, 11 Nov 2005, Tom Lane wrote:
Stephan Szabo [EMAIL PROTECTED] writes:
It looks to me like we should be supporting any exact numeric with scale 0
there (at least AFAICS from SQL92 and SQL03), so I don't think the current
behavior is compliant. It doesn't look like adding a numeric
Stephan Szabo [EMAIL PROTECTED] writes:
On Fri, 11 Nov 2005, Tom Lane wrote:
I was toying with the idea of making it translate instead to
pg_catalog.substring(foo, 1, (bar)::int4)
since AFAICS there isn't any other reasonable mapping once you have
committed to having the 1 in there. This
In article [EMAIL PROTECTED],
Martijn van Oosterhout kleptog@svana.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)
10 matches
Mail list logo