I am trying to create an aggregate function that works on whole tuples, but the system does not find them once defined ;(
hannu=# \d users Table "users" Column | Type | Modifiers ----------+---------+------------------------------------------------------ fname | text | not null lname | text | not null username | text | userid | integer | not null hannu=# create or replace function add_table_row(text,users) returns text as hannu-# 'state = args[0] hannu'# user = args[1]["fname"] + ":" + args[1]["lname"] hannu'# if state: hannu'# return state + "\\n" + user hannu'# else: hannu'# return user hannu'# ' hannu-# LANGUAGE 'plpython'; CREATE hannu=# select add_table_row('',users) from users; add_table_row --------------- jane:doe john:doe willem:doe rick:smith (4 rows) hannu=# create aggregate tabulate ( hannu(# basetype = users, hannu(# sfunc = add_table_row, hannu(# stype = text, hannu(# initcond = '' hannu(# ); CREATE hannu=# select tabulate(users) from users; ERROR: No such attribute or function 'tabulate' What am I doing wrong ? -------------- Hannu ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html