From: | Hannu Krosing <hannu(at)tm(dot)ee> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | creating aggregates that work on composite types (whole tuples) |
Date: | 2002-07-25 18:17:56 |
Message-ID: | 1027621076.29994.13.camel@taru.tm.ee |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Kangmo, Kim | 2002-07-25 18:43:30 | Two question about performance tuning issue. |
Previous Message | Hannu Krosing | 2002-07-25 17:09:08 | Re: why? |