argument of CASE/WHEN must not return a set

Поиск
Список
Период
Сортировка
От George Weaver
Тема argument of CASE/WHEN must not return a set
Дата
Msg-id F6E2A4DE57B240D69479FA734FFF3541@D420
обсуждение исходный текст
Ответы Re: argument of CASE/WHEN must not return a set
Список pgsql-general
Good morning,
 
I've have solved my problem in another way, but I am curious as to why I am getting the following error.
 
The following returns a boolean value a expected:
 
development=# SELECT LENGTH(ARRAY_TO_STRING(  REGEXP_MATCHES('12-70510','^[0-9,0-9.0-9]+')
development(#                        , ',')
development(#                        )  =
development-#        LENGTH('12-70510')
development-#
development-#     AS "12-70510";
 12-70510
----------------
 f
(1 row)
 
But if I put the comparison into a CASE or WHERE clause I get this error:
 
development=# SELECT CASE
development-#             WHEN LENGTH(ARRAY_TO_STRING(  REGEXP_MATCHES('12-70510','^[0-9,0-9.0-9]+')
development(#                                         , ',')
development(#                         )
development-#                  = LENGTH('12-70510')
development-#
development-#             THEN ARRAY_TO_STRING(  REGEXP_MATCHES('12-70510','^[0-9,0-9.0-9]+')
development(#                                  , ',')
development-#
development-#             ELSE ''
development-#         END AS "12-70510";
ERROR:  argument of CASE/WHEN must not return a set
LINE 2:             WHEN LENGTH(ARRAY_TO_STRING(  REGEXP_MATCHES('12...
 
 
What am I missing?
 
Thanks,
George

В списке pgsql-general по дате отправления:

Предыдущее
От: Keith Fiske
Дата:
Сообщение: Re: Planning error in dynamic string creation in plpgsql
Следующее
От: Nelson Green
Дата:
Сообщение: Re: Last inserted row id with complex PK