Re: Consolidate 'unique array values' logic into a reusable function? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Consolidate 'unique array values' logic into a reusable function?
Date
Msg-id 22244.1470585142@sss.pgh.pa.us
Whole thread Raw
In response to Consolidate 'unique array values' logic into a reusable function?  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: Consolidate 'unique array values' logic into a reusable function?
List pgsql-hackers
Thomas Munro <thomas.munro@enterprisedb.com> 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



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Heap WARM Tuples - Design Draft
Next
From: Tom Lane
Date:
Subject: Re: Bogus ANALYZE results for an otherwise-unique column with many nulls