Re: replace_matches does not return {null}

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: replace_matches does not return {null}
Дата
Msg-id 1336.1298392757@sss.pgh.pa.us
обсуждение исходный текст
Ответ на replace_matches does not return {null}  (Andreas Gaab <A.Gaab@scanlab.de>)
Список pgsql-sql
Andreas Gaab <A.Gaab@scanlab.de> writes:
> I tried to order a text-column only by parts of the entries. Therefore I used regexp_matches(), but unfortunately I
amloosing rows.
 

> SELECT regexp_matches('abc','[0-9]+'),  regexp_matches('123','[0-9]+');

> Does not return "{null}, {123}" but no result at all.

Yes, because regexp_matches returns a rowset of zero or more results.
The fine manual suggests putting it in a sub-select if what you want
is a null or a single result:
 SELECT ... , (SELECT regexp_matches(...)) FROM ...
        regards, tom lane


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

Предыдущее
От: Andreas Gaab
Дата:
Сообщение: replace_matches does not return {null}
Следующее
От: arthur_info
Дата:
Сообщение: Re: Retrieve the column values of a record without knowing the names