pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander H. Iliev <iliev@nimbus.dartmouth.edu>
To: pgsql-sql@postgresql.org
Subject: question on diagnostics
Date: Wed, 31 May 2000 23:12:54 -0400 (EDT)
Message-ID: <200006010312.XAA17634@nimbus.dartmouth.edu> (raw)

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




view thread (7+ messages)  latest in thread

Message-ID: <200006010312.XAA17634@nimbus.dartmouth.edu>
Permalink:  ../200006010312.XAA17634@nimbus.dartmouth.edu/
Also on:    postgresql.org/message-id/200006010312.XAA17634@nimbus.dartmouth.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: iliev@nimbus.dartmouth.edu
  Subject: Re: question on diagnostics
  In-Reply-To: <200006010312.XAA17634@nimbus.dartmouth.edu>
  References: <200006010312.XAA17634@nimbus.dartmouth.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox