Skip site navigation (1) Skip section navigation (2)

question on diagnostics

From: "Alexander H(dot) Iliev" <iliev(at)nimbus(dot)dartmouth(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: question on diagnostics
Date: 2000-06-01 03:12:54
Message-ID: 200006010312.XAA17634@nimbus.dartmouth.edu (view raw or flat)
Thread:
Lists: pgsql-sql
Hi all,

does anyone have a clue what this diagnostic from psql (v 7.0) means:
ERROR:  aggregate function in qual must be argument of boolean operator

I got it from this query:

SELECT *
FROM last_payment NATURAL INNER JOIN admin_info
WHERE date_part ('month', age(last_payment.date, timestamp 'now')) >= 3 AND
      balance > 0;

last_payment is a view of a natural join of 3 tables with an aggregation:

CREATE VIEW last_payment(ssn, cust_name, cust_addr, balance, date) AS
SELECT customer.ssn, cust_name, cust_addr, balance, MAX(date)
FROM customer, journal, payment_info
WHERE customer.ssn = journal.ssn AND
      journal.entry_num = payment_info.entry_num
GROUP BY customer.ssn, cust_name, cust_addr, balance;

oh, btw this select refused to use an SQL natural join among the 3 relations -
the server gives up and disconnects without warning.

admin_info is a normal table. 

the idea being to get tuples timestamped 3 or more months ago. I get the
impression both 'age' and 'date_part' functions are causing the problem - just a
date comparison without them works fine.

thanks for any ideas

cheers
alex


Responses

pgsql-sql by date

Next:From: Tom LaneDate: 2000-06-01 04:37:11
Subject: Re: question on diagnostics
Previous:From: Jan WieckDate: 2000-06-01 02:24:58
Subject: Re: [SQL] Re: create view security

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group