Re: [HACKERS] Solution for LIMIT cost estimation

Поиск
Список
Период
Сортировка
От Karl DeBisschop
Тема Re: [HACKERS] Solution for LIMIT cost estimation
Дата
Msg-id 200002141451.JAA28380@skillet.infoplease.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Solution for LIMIT cost estimation  (Peter Eisentraut <peter_e@gmx.net>)
Список 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@alert.infoplease.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Joel Reed
Дата:
Сообщение: patch for binding tuples from result set to user allocated memory
Следующее
От: Don Baccus
Дата:
Сообщение: Re: [HACKERS] Solution for LIMIT cost estimation