[GENERAL] Nullsif ? PG 9.1

Поиск
Список
Период
Сортировка
От Patrick B
Тема [GENERAL] Nullsif ? PG 9.1
Дата
Msg-id CAJNY3isjsDZA93NGR_8k0jmNL9TsME_f_CpKH+nSBSMf5wtoUA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [GENERAL] Nullsif ? PG 9.1  (Patrick B <patrickbakerbr@gmail.com>)
Список pgsql-general
Hi guys,

I've got this select:
 SELECT split_part(n.node_full_path::text, '/'::text, 8)::integer AS id,

However, not always I will get the 8th field, and because of that, i may get no data somethings.

Example:
/filesuser/client/27801123/attachment/4510/main
/filesuser/client/1111/attachment/21314134/file/12312312312/small/photo.jpg

Note that, sometimes it only goes until the 7th splitted_part, not always i will get the 8th.

How can I tell the select, if no 8th field is found, then returns null?

Thanks!
Patrick

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

Предыдущее
От: "Steve Petrie, P.Eng."
Дата:
Сообщение: [GENERAL] TimeScaleDB -- Open Source Time Series Database Released (www.i-programmer.info);
Следующее
От: Patrick B
Дата:
Сообщение: Re: [GENERAL] Nullsif ? PG 9.1