From: Josh Berkus <josh@agliodbs.com>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: 7.0.3 and 7.1.3 different results?
Date: Wed, 03 Oct 2001 10:07:58 -0700
Message-ID: <web-140986@davinci.ethosmedia.com> (raw)
In-Reply-To: <Pine.BSF.4.21.0110030828330.50902-100000@megazone23.bigpanda.com>
Stephan,
> Actually it seems to me that one NULL row is correct...
>
> 7.9 <query specification>
> 1) Case:
> a) If T is not a grouped table, then
You are correct according to the SQL spec.
However, depending on what interface I use for the database, I can get
an empty recordset rather than a single NULL row. This has more to do
with the interface translation (such as ODBC) than it does with what
PostgreSQL is returning.
Partly I think this is DB vendors and interpreters getting confused over
a consistency issue between SELECT SUM() and SELECT SUM() ... GROUP BY.
SELECT sum(totalamount)
FROM invoices
WHERE invoice_no > invoice_no;
-----------
NULL
SELECT invoice_no, sum(totalamount)
FROM invoices
WHERE invoice_no > invoice_no
GROUP BY invoice_no;
invoice_no|sum
--------------
(empty recordset)
Obviously not particularly troublesome behavior, as these results seem
to be more or less consistent across most vendor implementations. Plus
in many languages the tests for NULL and empty recordset overlap or are
easily combined. And this is pretty clearly defined in SQL 92, as you
point out.
-Josh
P.S. Can you answer my question about indexing, please please?
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, sszabo@megazone23.bigpanda.com
Subject: Re: 7.0.3 and 7.1.3 different results?
In-Reply-To: <web-140986@davinci.ethosmedia.com>
* 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