Re: [GENERAL] Types and SRF's

2004-09-01 Thread Jerry LeVan
Thank you for the response Pierre, select category, sum(amount) as sum_amount, extract (month from date) as month from all_accounts where (extract(year from date)=2003) group by category,month order by category,month is certainly much faster than what I am doing but as you pointed out, I want t

Re: [GENERAL] Types and SRF's

2004-09-01 Thread Pierre-Frédéric Caillaud
Your query looks suspiciously complicated... Why not process all 12 months in one shot with something like this : - only one subquery - no join - date between can make an index scan on date select category, sum(amount) as sum_amount, extract (month from date) as

Re: [GENERAL] Types and SRF's

2004-08-31 Thread Jerry LeVan
Doh, I was using \dT and \dT+ Thanks Jerry On Aug 31, 2004, at 3:14 PM, Tom Lane wrote: Jerry LeVan <[EMAIL PROTECTED]> writes: I would feel a bit more comfortable if I could recover the definition of the type at a later time, Try "\d annual_report_type" in psql. regards

Re: [GENERAL] Types and SRF's

2004-08-31 Thread Tom Lane
Jerry LeVan <[EMAIL PROTECTED]> writes: > I would feel a bit more comfortable if I could recover the definition > of the type at a later time, Try "\d annual_report_type" in psql. regards, tom lane ---(end of broadcast)--- T

[GENERAL] Types and SRF's

2004-08-31 Thread Jerry LeVan
Hi, I am trying to get my feet wet in SRF's I had to define a type in order to get my first attempt at a srf for an sql language function ie.. create type annual_report_type as ( category text, jan numeric(9,2), feb numeric(9,2), mar numeric(9,2), apr numeric(9,2), may numeric(9,2), jun numer