Re: [SQL] Function Parameters in GROUP BY clause cause errors

2006-03-23 Thread Davidson, Robert
: Re: [SQL] Function Parameters in GROUP BY clause cause errors I wrote: > Hmm, this seems like a plpgsql deficiency. It feels it can generate a > separate parameter symbol ($n) for each occurrence of each variable it > passes into a SQL query. But for this query to be legal, the two &g

Re: [SQL] Function Parameters in GROUP BY clause cause errors

2006-03-22 Thread Tom Lane
I wrote: > Hmm, this seems like a plpgsql deficiency. It feels it can generate a > separate parameter symbol ($n) for each occurrence of each variable it > passes into a SQL query. But for this query to be legal, the two > instances of IntervalMinutes have to be represented by the *same* > parame

Re: [SQL] Function Parameters in GROUP BY clause cause errors

2006-03-22 Thread Christian Paul B. Cosinas
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Davidson, Robert Sent: Wednesday, March 22, 2006 1:12 PM To: pgsql-sql@postgresql.org Subject: [SQL] Function Parameters in GROUP BY clause cause errors   When I use a parameter in a query which aggregates it fails with

Re: [SQL] Function Parameters in GROUP BY clause cause errors

2006-03-22 Thread Tom Lane
"Davidson, Robert" <[EMAIL PROTECTED]> writes: > ERROR: column "em.email_creation_datetime" must appear in the GROUP BY = > clause or be used in an aggregate function > CONTEXT: SQL statement " select to_char(to_timestamp(EXTRACT(HOUR FROM = > em.email_creation_datetime) || ':' || (EXTRACT(MINUTE

[SQL] Function Parameters in GROUP BY clause cause errors

2006-03-22 Thread Davidson, Robert
Title: Function Parameters in GROUP BY clause cause errors When I use a parameter in a query which aggregates it fails with a GROUP BY error. What syntax can I use to avoid this error? CREATE TABLE test (email_creation_datetime timestamp); INSERT INTO test VALUES ('2006-03-20 09:00'); INSE