Thomas Kellerer <spam_eater@gmx.net> writes:
> I always wonder whether it's more efficient to aggregate this path
> using an array rather than a varchar. Mainly because representing the
> numbers as varchars will require more memory than as integer, but then
> I don't know the overhead of an array structure and whether appending
> to an array doesn't actually copy it.
If you go that direction, you're not far away from the ltree extension
(which might also be a solution for the OP's problem).