From: Adrian Klaver <adrian.klaver@aklaver.com>
To: David G. Johnston <david.g.johnston@gmail.com>
To: Mike Martin <redtux1@gmail.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Regex on field value
Date: Sat, 14 Apr 2018 14:12:25 -0700
Message-ID: <d4db202a-82a0-2d6d-c8d4-eee479702d61@aklaver.com> (raw)
In-Reply-To: <CAKFQuwaRzFLS0UHq=jCXbHXCUaE4vxb4OLG6rSbSemLZR=9LMw@mail.gmail.com>
References: <CAOwYNKZEap+A9r_o9dZHaxnBAziXWgjDhkiPDjg-n5xTHy9yxw@mail.gmail.com>
<CAKFQuwaRzFLS0UHq=jCXbHXCUaE4vxb4OLG6rSbSemLZR=9LMw@mail.gmail.com>
On 04/14/2018 02:06 PM, David G. Johnston wrote:
> On Saturday, April 14, 2018, Mike Martin <redtux1@gmail.com
> <mailto:redtux1@gmail.com>> wrote:
>
> Is this possible, eg
> Substring(field, regex include other field name)
Something like?:
select substring(link_key from '^' || c_id ), link_key, c_id from
projection where link_key != 'no_key' limit 10;
substring | link_key | c_id
-----------+-------------+--------
6RPLF | 6RPLF-1646 | 6RPLF
6RPLF | 6RPLF-1646 | 6RPLF
6RPLF | 6RPLF-1646 | 6RPLF
6RPLF | 6RPLF-1646 | 6RPLF
4RPLF | 4RPLF-1694 | 4RPLF
10CEHB | 10CEHB-2628 | 10CEHB
10CEHB | 10CEHB-2628 | 10CEHB
10CEHB | 10CEHB-2628 | 10CEHB
10CEHB | 10CEHB-1698 | 10CEHB
1GPLF | 1GPLF-1704 | 1GPLF
(10 rows)
>
>
> Your example doesn't make sense but if you are asking whether a regular
> expression can be stored in a column the answer is yes - though it's
> nothing but a text value with runtime limitations.
>
> David J.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, david.g.johnston@gmail.com, redtux1@gmail.com
Subject: Re: Regex on field value
In-Reply-To: <d4db202a-82a0-2d6d-c8d4-eee479702d61@aklaver.com>
References: <CAOwYNKZEap+A9r_o9dZHaxnBAziXWgjDhkiPDjg-n5xTHy9yxw@mail.gmail.com> <CAKFQuwaRzFLS0UHq=jCXbHXCUaE4vxb4OLG6rSbSemLZR=9LMw@mail.gmail.com> <d4db202a-82a0-2d6d-c8d4-eee479702d61@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox