FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.25k stars 215 forks source link

Aggregate UDF [CORE1326] #1745

Open firebird-automations opened 17 years ago

firebird-automations commented 17 years ago

Submitted by: Igor Lobov (ivl)

Is duplicated by CORE3162

Votes: 9

Create a way to create aggregate UDFs

firebird-automations commented 16 years ago
Modified by: @pcisar Workflow: jira \[ 12350 \] =\> Firebird \[ 14884 \]
firebird-automations commented 15 years ago

Commented by: Ivan (patuljak)

mysql support this and maybe other databases.

http://books.google.com/books?id=kVB1wiF87ooC&pg=PA265&lpg=PA265&dq=mysql+udf+aggregate+example&source=bl&ots=HOlP34LbdM&sig=Fcj_7w5NycrtKhxpUbAREpMQ5K0&hl=en&ei=saTdSub8OIGUjAe838xt&sa=X&oi=book_result&ct=result&resnum=5&ved=0CBkQ6AEwBA#v=onepage&q=mysql%20udf%20aggregate%20example&f=false

why is this important?

if I need functions which contains few aggregate function then the best way for this problem is aggregate UDF.

firebird c-api does not support this and I don't know why?

many special functions which people need can't be write in sql query. can be but with two or more stored procedures.

for example consider standard deviation

http://en.wikipedia.org/wiki/Standard_deviation

first query is avg(x) on stored procedures. input parameter is one column-> x. then must using cursor and for each x calculate (x-avg(x))^2 as y

then must run query sqrt(sum(y)/count(x))

I know that somebody will say that database is not for processing data.

cursor is very slow, ETL (SISS) is fast but for processing data is slow. ETL(SISS) is only for transform and migrate data.

application for statistics is also not very good.

what users want is only enable aggregate UDF in c-api and nothing else.

firebird-automations commented 15 years ago
Modified by: @asfernandes assignee: Adriano dos Santos Fernandes \[ asfernandes \]
firebird-automations commented 14 years ago
Modified by: @asfernandes Link: This issue is duplicated by [CORE3162](https://github.com/FirebirdSQL/firebird/issues?q=CORE3162+in%3Atitle) \[ [CORE3162](https://github.com/FirebirdSQL/firebird/issues?q=CORE3162+in%3Atitle) \]
firebird-automations commented 14 years ago
Modified by: Ivan (patuljak) Link: This issue is duplicated by [CORE3163](https://github.com/FirebirdSQL/firebird/issues?q=CORE3163+in%3Atitle) \[ [CORE3163](https://github.com/FirebirdSQL/firebird/issues?q=CORE3163+in%3Atitle) \]
firebird-automations commented 14 years ago
Modified by: @dyemanov Link: This issue is duplicated by [CORE3163](https://github.com/FirebirdSQL/firebird/issues?q=CORE3163+in%3Atitle) \[ [CORE3163](https://github.com/FirebirdSQL/firebird/issues?q=CORE3163+in%3Atitle) \] =\>
firebird-automations commented 13 years ago

Commented by: adnanoncevarlik (adnanoncevarlik)

Hi All,

May be wrong place to say but we want to create functions on FIREBIRD and want to use in SELECT statements. Like this,

CREATE MY_FUNC_CALC_AGE(prmBirthDay TIMESTAMP) RETURNS RET_AGE INTEGER BEGIN RET_AGE = DATEDIFF(YEAR FROM prmBirthDay TO CURRENT_DATE) ;
SUSPEND ; END

SELECT NAME, SIRNAME, MY_FUNC_CALC_AGE( BIRTHDAY) FROM MY_TABLE

When this issue will planned to solve ?

Thank you and best regards Adnan

firebird-automations commented 13 years ago

Commented by: @dyemanov

It's implemented in FB v3.0.

firebird-automations commented 11 years ago

Commented by: Mason Wheeler (masonwheeler)

Is there any documentation available on this, as to how one would go about creating an external aggregate function in FB 3.0?

firebird-automations commented 11 years ago

Commented by: @asfernandes

It's simple PSQL functions which is implemented. Aggregate function is not nor will be in FB 3.0.

firebird-automations commented 11 years ago

Commented by: Juan Antonio Castillo (jachguate)

Sadly. is there any plan to support it on a later version? It's known which version?

firebird-automations commented 11 years ago

Commented by: Mason Wheeler (masonwheeler)

What's the rationale for this? Most other serious RDBMSes have a way to define external aggregates. It's something that's very noticeably lacking from Firebird.

firebird-automations commented 11 years ago

Commented by: @asfernandes

Probably in the next major version.