Re: Nullsif ? PG 9.1

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Nullsif ? PG 9.1
Date: 2017-04-09 08:31:10
Message-ID: CAJNY3itbE0s87c-5RRx80UKeOm=SdewCViRdSaPEP73z3YoSbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2017-04-09 20:18 GMT+12:00 Patrick B <patrickbakerbr(at)gmail(dot)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
> <(231)%20231-2312>/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
>

Sorry guys.. Got it!
https://www.postgresql.org/docs/9.1/static/functions-conditional.html

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nicolas Paris 2017-04-09 11:58:42 Re: TimeScaleDB -- Open Source Time Series Database Released (www.i-programmer.info);
Previous Message Patrick B 2017-04-09 08:18:41 Nullsif ? PG 9.1