My use case: I was writing some tests where I just needed some inets and macaddrs in a database table with certain properties. I tried to use the following queries: INSERT INTO inet_table (inet, ..) VALUES ((SELECT max(inet) + 1 FROM inet_table), ...); INSERT INTO macaddr_table (macaddr, ...) VALUES ((SELECT max(macaddr) + 1 FROM macaddr_table), ...); This works fine for the inet type, but the macaddr failed this. I tried adding some functions for macaddr_smaller/macaddr_larger to implement the min/max. The code for it was very trivial, but then I got completely lost in pg_proc.h/pg_aggregate.h. I fail to find the documentation for this files as well, is there any reference I could use to finish my work? -- Herwin Weststrate