Re: [HACKERS] Solution for LIMIT cost estimation

From: Karl DeBisschop <kdebisschop(at)range(dot)infoplease(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Solution for LIMIT cost estimation
Date: 2000-02-14 14:51:06
Message-ID: 200002141451.JAA28380@skillet.infoplease.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


>> 4. Fascist variant of #3: make LIMIT without ORDER BY be an error.
>
>Got my vote for that. At least make it a notice: "NOTICE: LIMIT without
>ORDER BY results in random data being returned" -- That'll teach 'em. ;)

Given the nature of SQL, how could it be otherwise. Select is defined
to be unordered. This seems to advocate building a generic SQL
tutorial into postgreSQL.

I for one would very much rather not have that notice. My reasoning
is thus:

Say I need a quick shell script to verify that a table has been loaded
with reasonable values as part of a cron procedure. One way to do the
might be to make a shell script:

#!/bin/sh
if ! psql feature -tc "select * from elm limit 1" | egrep "^ +[0-9]+|" >/dev/null;
then
echo no data loaded;
fi

Thus, I cron this and get email if there is no record returned.
AFAICT, this is what should happen. But if you start adding wornings
to this perfectly valid query, which will presumedly come out on
STDERR, I will get email from this, even though the query and its
returns were valid and expected. And I don't want to direct stderr to
/dev/null because I do want to be warned if there really is an error.

Just my $0.02 worth.

--
Karl DeBisschop <kdebisschop(at)alert(dot)infoplease(dot)com>
617.832.0332 (Fax: 617.956.2696)

Information Please - your source for FREE online reference
http://www.infoplease.com - Your Ultimate Fact Finder
http://kids.infoplease.com - The Great Homework Helper

Netsaint Plugins Development
http://netsaintplug.sourceforge.net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Don Baccus 2000-02-14 14:59:18 Re: [HACKERS] Solution for LIMIT cost estimation
Previous Message Don Baccus 2000-02-14 14:47:32 Re: [HACKERS] Solution for LIMIT cost estimation