Re: Consolidate 'unique array values' logic into a reusable function?
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2016-08-07T15:52:22Z
Lists: 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
Commits
-
Skip memcpy(x, x) in qunique().
- 5b630501e9fa 13.0 landed
-
Add reusable routine for making arrays unique.
- 7815e7efdb4c 13.0 landed