Search Postgresql Archives

Re: Regex on field value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/14/2018 02:06 PM, David G. Johnston wrote:
On Saturday, April 14, 2018, Mike Martin <redtux1@xxxxxxxxx <mailto:redtux1@xxxxxxxxx>> 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@xxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux