Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f7STR-0000bE-O2 for pgsql-general@arkaria.postgresql.org; Sat, 14 Apr 2018 21:12:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f7STQ-0004eI-Il for pgsql-general@arkaria.postgresql.org; Sat, 14 Apr 2018 21:12:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f7STO-0004e9-3x for pgsql-general@lists.postgresql.org; Sat, 14 Apr 2018 21:12:40 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f7STF-0001jj-3H for pgsql-general@lists.postgresql.org; Sat, 14 Apr 2018 21:12:37 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 1081220D1F; Sat, 14 Apr 2018 17:12:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 14 Apr 2018 17:12:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=nvh97NIg5Kq6LujHjj7+x+FZcIHfG 95RMQinIHOTbUY=; b=mtWW/r3C/fZwOhSX+svR3xqeScEzlg0pfHumK1SG2YeVK ajZcn0zHE0M0P0gjXmpseTV7lOQhKXOp78vLNezCSoFMoAQX7d4HfL08/rYxifal qEix6/omyBRjIrT3jqStI8FakvoBwziuYo77VzuOIBPT5xGVOki87+wDjdT3BMyJ l5gnOmW6gpA87ME2lYBv/VTiPgOurfbziNWazecXC4mTIU1Sjk66qzThGSZu08M2 FvgMWAaXcf8w8o9yCA1ry3qA29YMBRHDIA86V9DcAb9Nfx7gABgcoMKpQ9rzffUe hqSxaklJqcQz+rrYvkHUWkAbZOTcEjrcm2bIAWQdQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=nvh97N Ig5Kq6LujHjj7+x+FZcIHfG95RMQinIHOTbUY=; b=MK+bPm3MpqC77XJpYbkcjW dOB/WiHHYX+IL+3DCV8QUwqezAl04rS6ZzxIigfiJbok1wrAhtgcywAn1VAXxI8r RKspg1+yTeMpcGApX05UxWkT7XQlVyH7NfyPXZYHCA8SMBTEKd9ySDFE6Zf63hVb SzzW443c3Ds5TnGb7QKEc74ZZt81X3JEu+vwkTD/8Ee2dhO4jqYUeTEIRBVg7sJs xmic7NrqndSB6/fn2LNPMB6yievnRHNouuN5D9O3S+y9sTe1lhQNXNqAt2ptxMjF LiLplwwb19VRCgiMFm2zM3XPH9ECqRtI9pVLrwB8fIod0wCHoy5+S9IW0NbxrYdQ == X-ME-Sender: Received: from [192.168.1.2] (71-35-123-124.tukw.qwest.net [71.35.123.124]) by mail.messagingengine.com (Postfix) with ESMTPA id 3B954E4434; Sat, 14 Apr 2018 17:12:26 -0400 (EDT) Subject: Re: Regex on field value To: "David G. Johnston" , Mike Martin Cc: "pgsql-general@lists.postgresql.org" References: From: Adrian Klaver Message-ID: Date: Sat, 14 Apr 2018 14:12:25 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 04/14/2018 02:06 PM, David G. Johnston wrote: > On Saturday, April 14, 2018, Mike Martin > 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