Re: [GENERAL] Nullsif ? PG 9.1 - Mailing list pgsql-general

From Patrick B
Subject Re: [GENERAL] Nullsif ? PG 9.1
Date
Msg-id CAJNY3itbE0s87c-5RRx80UKeOm=SdewCViRdSaPEP73z3YoSbw@mail.gmail.com
Whole thread Raw
In response to [GENERAL] Nullsif ? PG 9.1  (Patrick B <patrickbakerbr@gmail.com>)
List pgsql-general


2017-04-09 20:18 GMT+12:00 Patrick B <patrickbakerbr@gmail.com>:
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 by date:

Previous
From: Patrick B
Date:
Subject: [GENERAL] Nullsif ? PG 9.1
Next
From: Nicolas Paris
Date:
Subject: Re: [GENERAL] TimeScaleDB -- Open Source Time Series DatabaseReleased (www.i-programmer.info);