dbTalk Databases Forums  

[Info-Ingres] select first 0

comp.databases.ingres comp.databases.ingres


Discuss [Info-Ingres] select first 0 in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Roy Hann
 
Posts: n/a

Default Re: [Info-Ingres] select first 0 - 04-28-2010 , 04:12 AM






Kevin Smedley wrote:

Quote:
E_US0874 Invalid fetch first n rows value. It must be a positive
integer.
(Wed Apr 28 08:19:10 2010)

If this is the case, then that might make the case for not returning an
error for the 'select first 0' where 0 is a constant less persuasive.
I can't see a reason to define an error state into existence.
Asking for zero rows is not an error under any circumstances.

It's the wording of the error message that's the bug. It should read
"Invalid fetch first n rows value. It must be a non-negative integer
constant."

--
Roy

UK Ingres User Association Conference 2010 will be on Tuesday June 8 2010
Go to http://www.iua.org.uk/join to get on the mailing list.

Reply With Quote
  #12  
Old   
Roy Hann
 
Posts: n/a

Default Re: [Info-Ingres] select first 0 - 04-28-2010 , 04:35 AM






Damien Owen wrote:

Quote:
that doesn't mean that [FIRST n] wont have a practical use in
the real world. [snip] somesimtes you just have to get the job done...
even if it offends the relational purists.
Hell, I'm way past being offended by SQL; it's a question of what FIRST
means if there is no specified ordering. Ingres allows FIRST without
ORDER BY, so it just means SELECT RANDOMLY CHOSEN n...

Try explaining to your boss why MODIFYing a table breaks your
application; or why partitioning breaks it, or why running optimizedb
breaks it, or a new release of Ingres,...

--
Roy

UK Ingres User Association Conference 2010 will be on Tuesday June 8 2010
Go to http://www.iua.org.uk/join to get on the mailing list.

Reply With Quote
  #13  
Old   
withdefault
 
Posts: n/a

Default Re: select first 0 - 04-28-2010 , 05:08 AM



In my copy of the standard it does say that including a <fetch first
clause> is possibly non-deterministic.
If the <fetch first row count> is omitted the default value is 1, the
<fetch first row count> must be greater than 0 and a value of less
than 1 should raise an exception.

I know, just because it's in the standard doesn't make it right.

As a side note, there are some SQL implementations that do not return
a relations and support the <fetch first clause> syntax; so a <fetch
first clause> with a <fetch first row count> of 0 returns nothing.

Reply With Quote
  #14  
Old   
Ian Kirkham
 
Posts: n/a

Default Re: [Info-Ingres] select first 0 - 04-28-2010 , 05:23 AM



In practical terms, implementing:
SELECT RANDOMLY CHOSEN n ...
Is harder to do and more inefficient. (and QA would have to grapple with
assuring randomness)
What I think we have might be better named:
SELECT ARBITRARILY CHOSEN n ROWS ...
The extra keyword would help some of the syntax problems.

FIRST is probably not the best keyword; FIRST can imply positional
significance but could also leave you looking for the FIRST n in your
backups. I would have preferred LIMIT TO n ROWS and after the FROM
clause but that might biased from RdB days.


-----Original Message-----
From: info-ingres-bounces (AT) kettleriver...ting (DOT) com
[mailto:info-ingres-bounces (AT) kettleriverconsulting (DOT) com] On Behalf Of Roy
Hann
Sent: 28 April 2010 10:36
To: info-ingres (AT) kettleriverconsulting (DOT) com
Subject: Re: [Info-Ingres] select first 0

Damien Owen wrote:

Quote:
that doesn't mean that [FIRST n] wont have a practical use in
the real world. [snip] somesimtes you just have to get the job done...
even if it offends the relational purists.
Hell, I'm way past being offended by SQL; it's a question of what FIRST
means if there is no specified ordering. Ingres allows FIRST without
ORDER BY, so it just means SELECT RANDOMLY CHOSEN n...

Try explaining to your boss why MODIFYing a table breaks your
application; or why partitioning breaks it, or why running optimizedb
breaks it, or a new release of Ingres,...

--
Roy

UK Ingres User Association Conference 2010 will be on Tuesday June 8
2010
Go to http://www.iua.org.uk/join to get on the mailing list.


_______________________________________________
Info-Ingres mailing list
Info-Ingres (AT) kettleriverconsulting (DOT) com
http://ext-cando.kettleriverconsulti...fo/info-ingres

Reply With Quote
  #15  
Old   
Roy Hann
 
Posts: n/a

Default Re: select first 0 - 04-28-2010 , 05:27 AM



withdefault wrote:

Quote:
If the <fetch first row count> is omitted the default value is 1, the
fetch first row count> must be greater than 0 and a value of less
than 1 should raise an exception.
Arrrgh! F***ing boneheads. That isn't just unnecessary, it's plain,
flat-out wrong to want that behaviour.

This annoys me more than usual because as much as I hate SQL I *do*
think a standard, however imperfect, is infinitely better than no
standard at all. But something like this just demands to be defied.
There is plenty of other silly stuff in the standard that Ingres
ignores.

I say Ingres should return an empty table (unless it is installed with
strict SQL92 compliance turned on.)

Quote:
I know, just because it's in the standard doesn't make it right.
Clearly.

Quote:
As a side note, there are some SQL implementations that do not return
a relations and support the <fetch first clause> syntax; so a <fetch
first clause> with a <fetch first row count> of 0 returns nothing.
Yeah, well that's just heading off into Looney Land. There is no point
trying to defend that to anyone, "relational purist" or otherwise.

--
Roy

UK Ingres User Association Conference 2010 will be on Tuesday June 8 2010
Go to http://www.iua.org.uk/join to get on the mailing list.

Reply With Quote
  #16  
Old   
Roy Hann
 
Posts: n/a

Default Re: [Info-Ingres] select first 0 - 04-28-2010 , 05:30 AM



Ian Kirkham wrote:

Quote:
In practical terms, implementing:
SELECT RANDOMLY CHOSEN n ...
Is harder to do and more inefficient. (and QA would have to grapple with
assuring randomness)
What I think we have might be better named:
SELECT ARBITRARILY CHOSEN n ROWS ...
You are quite right about that, and it is in keeping with the
boiler-plate code reminding us that session temporary tables PRESERVE
ROWS WITH NORECOVERY! :-)

Quote:
[snip]I would have preferred LIMIT TO n ROWS [...].
Me too!! But after the ORDER BY clause.

--
Roy

UK Ingres User Association Conference 2010 will be on Tuesday June 8 2010
Go to http://www.iua.org.uk/join to get on the mailing list.

Reply With Quote
  #17  
Old   
withdefault
 
Posts: n/a

Default Re: select first 0 - 04-28-2010 , 11:27 AM



On Apr 28, 11:30*am, Roy Hann <specia... (AT) processed (DOT) almost.meat> wrote:
Quote:
Ian Kirkham wrote:
In practical terms, implementing:
SELECT RANDOMLY CHOSEN n ...
Is harder to do and more inefficient. (and QA would have to grapple with
assuring randomness)
What I think we have might be better named:
SELECT ARBITRARILY CHOSEN n ROWS ...

You are quite right about that, and it is in keeping with the
boiler-plate code reminding us that session temporary tables PRESERVE
ROWS WITH NORECOVERY! *:-)

[snip]I would have preferred LIMIT TO n ROWS [...].

Me too!! *But after the ORDER BY clause.

--
Roy

UK Ingres User Association Conference 2010 will be on Tuesday June 8 2010
Go tohttp://www.iua.org.uk/jointo get on the mailing list.
The <fetch first clause> syntax of [OFFSET m] [FETCH FIRST|NEXT n ROWS|
ROW ONLY] is available too which can succeed the "optional" ORDER BY
clause.

Reply With Quote
  #18  
Old   
James K. Lowden
 
Posts: n/a

Default Re: [Info-Ingres] select first 0 - 04-28-2010 , 08:06 PM



Roy Hann wrote:
Quote:
I don't feel that SELECT FIRST 0... is an error. It should do what
Marty's programmer expected.

What do other DBMSs do?
Courtesy of Microsoft:

[22] varley.FreeTDS.1> select top 0 type from systypes
[22] varley.FreeTDS.2> go
type
----

(0 rows affected)

--jkl

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.