creating aggregates that work on composite types (whole tuples)

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема creating aggregates that work on composite types (whole tuples)
Дата
Msg-id 1027621076.29994.13.camel@taru.tm.ee
обсуждение исходный текст
Ответы Re: creating aggregates that work on composite types (whole tuples)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 nulllname    | text
  | not nullusername | 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:doejohn:doewillem:doerick: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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: why?
Следующее
От: Marc Lavergne
Дата:
Сообщение: Re: Oracle Decode Function