Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bWQOj-0003bb-SS for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Aug 2016 15:53:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bWQOi-0002nD-Px for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Aug 2016 15:53:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bWQNL-0001A0-Oi for pgsql-hackers@postgresql.org; Sun, 07 Aug 2016 15:52:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bWQNE-0001Y3-Mv for pgsql-hackers@postgresql.org; Sun, 07 Aug 2016 15:52:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u77FqMHO022245; Sun, 7 Aug 2016 11:52:22 -0400 From: Tom Lane To: Thomas Munro cc: Pg Hackers Subject: Re: Consolidate 'unique array values' logic into a reusable function? In-reply-to: References: Comments: In-reply-to Thomas Munro message dated "Sun, 07 Aug 2016 16:45:39 +1200" Date: Sun, 07 Aug 2016 11:52:22 -0400 Message-ID: <22244.1470585142@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Thomas Munro writes: > Here's a sketch patch that creates a function array_unique which takes > the same arguments as qsort or qsort_arg and returns the new length. Hmm ... I'd be against using this in backend/regex/, because I still have hopes of converting that to a standalone library someday (and in any case it needs to stay compatible with Tcl's copy of the code). But otherwise this seems like a reasonable proposal. As for the function name, maybe "qunique()" to go with "qsort()"? I'm not thrilled with "array_unique" because that sounds like it is meant for Postgres' array data types. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers