BUG #8228: Unexpected "set-valued function" with varchar(n) but not varchar
От | david.g.johnston@gmail.com |
---|---|
Тема | BUG #8228: Unexpected "set-valued function" with varchar(n) but not varchar |
Дата | |
Msg-id | E1UnCv4-0007oF-Bo@wrigleys.postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #8228: Unexpected "set-valued function" with varchar(n) but not varchar
|
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 8228 Logged by: David Johnston Email address: david.g.johnston@gmail.com PostgreSQL version: 9.0.13 Operating system: Ubuntu Linux 10.04 Description: = The following query results in "SQL Error: ERROR: set-valued function called in context that cannot accept a set" SELECT *, CASE WHEN id =3D 2 THEN (regexp_matches(input_string,'^0*([1-9]\d+)$'))[1] ELSE input_string END::varchar(30) AS o_l2_a = FROM ( VALUES (1,''), (2,'0000000049404'),(3,'FROM 10000000876') ) l0_src (id, input_string) The nearly identical query: SELECT *, CASE WHEN id =3D 2 THEN (regexp_matches(input_string,'^0*([1-9]\d+)$'))[1] ELSE input_string END::varchar AS o_l2_a = FROM ( VALUES (1,''), (2,'0000000049404'),(3,'FROM 10000000876') ) l0_src (id, input_string) returns 3 records as expected. The only difference is that the cast at the end of the case construct uses "varchar(30)" in the failure situation but a plain "varchar" in the successful situation. version PostgreSQL 9.0.13 on x86_64-unknown-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5) 4.4.3, 64-bit Using "substring(CASE ... END::varchar,1,30)" also results in the "set-valued function" error message. David J.
В списке pgsql-bugs по дате отправления: