RE: [INTERFACES] JDBC next() method

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: "jbarnett(at)pobox(dot)com" <jbarnett(at)pobox(dot)com>, "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "'pgsql-interfaces(at)hub(dot)org'" <pgsql-interfaces(at)hub(dot)org>
Subject: RE: [INTERFACES] JDBC next() method
Date: 1999-04-25 14:25:14
Message-ID: l03130300b348d48a52d8@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

At 15:58 +0300 on 25/04/1999, Jon Barnett wrote:

> It seems that the standard is quite ambiguous as to what it expects and
>doesn't
> address the limit case (what happens for an aggregate function result when a
> table is empty). My SQL Programmer's Reference (ISBN 1-56604-760-9) has
> nothing to say on this matter and I haven't successfully found a copy of the
> SQL92 specifications (seems harder than tracking down a printed copy of
> "Historia Regum Britanniae"). I suspect that the SQL specifications may
>also
> overlook the issue as well. *sigh*

Ah, well, I have a (late draft) of the SQL92 standard. And here is what it
has to say on the matter (note 2-b-i):

<<< begin quotation from standard >>>

General Rules

1) Case:

a) If COUNT(*) is specified, then the result is the cardinality
of T.

b) Otherwise, let TX be the single-column table that is the
result of applying the <value expression> to each row of T
and eliminating null values. If one or more null values are
eliminated, then a completion condition is raised: warning-
null value eliminated in set function.

2) If DISTINCT is specified, then let TXA be the result of elimi-
nating redundant duplicate values from TX. Otherwise, let TXA be
TX.

Case:

a) If the <general set function> COUNT is specified, then the
result is the cardinality of TXA.

b) If AVG, MAX, MIN, or SUM is specified, then

Case:

i) If TXA is empty, then the result is the null value.

ii) If AVG is specified, then the result is the average of the
values in TXA.

iii) If MAX or MIN is specified, then the result is respec-
tively the maximum or minimum value in TXA. These results
are determined using the comparison rules specified in
Subclause 8.2, "<comparison predicate>".

iv) If SUM is specified, then the result is the sum of the
values in TXA. If the sum is not within the range of the
data type of the result, then an exception condition is
raised: data exception-numeric value out of range.

<<< end quotation from standard >>>

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 1999-04-25 16:40:44 Re: [INTERFACES] JDBC next() method
Previous Message Oliver Elphick 1999-04-25 13:14:39 Re: [INTERFACES] libpq++