Jay Levitt <jay.levitt@gmail.com> writes:
> Perfect. Composite types are exactly what I need here; the application can
> declare its composite type and provide distance functions for each member,
> and the extension can use those to calculate similarity. How do I introspect
> the composite type's pg_class to see what it contains? I assume there's a
> better way than SPI on system catalogs :)
Definitely. Take a look at record_out, record_cmp, and sibling
functions on generic composites (src/backend/utils/adt/rowtypes.c).
You might or might not feel like wiring in more assumptions than those
have about the possible contents of the record type.
regards, tom lane