Re: [firebird-support] Why PLAN token is not allowed after ORDER BY? - Email found in subject

2012-06-04 Thread Kjell Rilbe
Den 2012-06-03 21:23 skrev Alec Swan såhär: On Sun, Jun 3, 2012 at 1:06 PM, Leyne, Seans...@broadviewsoftware.comwrote: Yes, there is a limit to the length of an Firebird index name, but you could come up with an algorithm which would be able to shorten the names as appropriate. For example an

Re: [firebird-support] Why PLAN token is not allowed after ORDER BY?

2012-06-04 Thread Mark Rotteveel
On Sun, 3 Jun 2012 08:59:14 -0600, Alec Swan alecs...@gmail.com wrote: Thanks, Mark. I found FB 2.5 SQL Language reference here http://www.firebirdsql.org/refdocs/langrefupd25-select.html but it does not contain the grammar for the entire SELECT statement, just individual fragments, such

RE: [firebird-support] Why PLAN token is not allowed after ORDER BY?

2012-06-04 Thread Svein Erling Tysvær
I consider this issue resolved with one side note that having PLAN hint which affects ORDER BY execution before ORDER BY clause is misleading. Don't forget UNION, Alec. I.e. select * from T where a = 1 PLAN (T INDEX (IDX_TA)) union select * from T where a = 2 PLAN (T INDEX (IDX_TA)) order by 1

Re: [firebird-support] Why PLAN token is not allowed after ORDER BY?

2012-06-04 Thread Alec Swan
UNION use case makes sense, thanks! On Mon, Jun 4, 2012 at 1:29 AM, Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no wrote: ** I consider this issue resolved with one side note that having PLAN hint which affects ORDER BY execution before ORDER BY clause is misleading. Don't

Re: [firebird-support] Why PLAN token is not allowed after ORDER BY?

2012-06-03 Thread Alec Swan
Thanks, Mark. I found FB 2.5 SQL Language reference here http://www.firebirdsql.org/refdocs/langrefupd25-select.html but it does not contain the grammar for the entire SELECT statement, just individual fragments, such as JOIN, ORDER BY, etc. Where can I find a comprehensive syntax definition

Re: [firebird-support] Why PLAN token is not allowed after ORDER BY?

2012-06-03 Thread Alec Swan
I am sorry for the last post I did not see that Mark already answered it. Is there online docs for SELECT syntax? Thank you, Mark. On Sun, Jun 3, 2012 at 8:59 AM, Alec Swan alecs...@gmail.com wrote: Thanks, Mark. I found FB 2.5 SQL Language reference here

RE: [firebird-support] Why PLAN token is not allowed after ORDER BY? - Email found in subject

2012-06-03 Thread Leyne, Sean
We create indexes programmatically and we we generate their names based on their definition, such the columns they index. If that is the case, why is the name gibberish? You could create an index which has the name(s) of the source fields (ie. PK_PhysicalCopy.ID or FK_PhysicalCopy.CopyID or

Re: [firebird-support] Why PLAN token is not allowed after ORDER BY?

2012-06-03 Thread Michael Ludwig
Alec Swan schrieb am 03.06.2012 um 09:01 (-0600): Is there online docs for SELECT syntax? There's an online HTML version of the SQL reference linked to from the overview page: http://www.ibphoenix.com/files/60sqlref.html On Sun, Jun 3, 2012 at 8:59 AM, Alec Swan alecs...@gmail.com wrote:

Re: [firebird-support] Why PLAN token is not allowed after ORDER BY? - Email found in subject

2012-06-03 Thread Alec Swan
Sean, you nailed the reason on the head - the FB restriction on index names. In fact, on SQL Server we have pretty index names :) Unfortunately, we didn't have the resources to spend in prettyfying the index names at the time. At this point it's even harder to do this because of upgrade scenarios.

Re: [firebird-support] Why PLAN token is not allowed after ORDER BY?

2012-06-03 Thread Alec Swan
Thank you! I consider this issue resolved with one side note that having PLAN hint which affects ORDER BY execution before ORDER BY clause is misleading. Alec On Sun, Jun 3, 2012 at 1:15 PM, Michael Ludwig mil...@gmx.de wrote: ** Alec Swan schrieb am 03.06.2012 um 09:01 (-0600): Is

[firebird-support] Why PLAN token is not allowed after ORDER BY?

2012-06-02 Thread Alec Swan
Hello, I am using FB 2.5 and execute SQL using Flamerobin. I am trying to specify a plan for a query that has ORDER BY clause. I get a invalid token PLAN error if I specify the plan after ORDER BY, but it works OK if I specify the plan before ORDER BY. But the plan contains instructions for ORDER

Re[4]: [firebird-support] Why PLAN token is not allowed after ORDER BY?

2012-06-02 Thread Dmitry Kuzmenko
Hello, Alec! AS 2. Changed the query to A INNER JOIN B ORDER BY X PLAN P, where P is the AS plan generated by FB in #1. Received Unexpected token PLAN error. AS 3. Change the query to A INNER JOIN B PLAN P ORDER BY X - success! AS Why does #3 succeed but #2 fail? because inner join is not

Re: Re[4]: [firebird-support] Why PLAN token is not allowed after ORDER BY?

2012-06-02 Thread Alec Swan
I would have never expected a parser token error if the query syntax is correct but the plan itself is bad. That would have been a run-time, not compile-time error! And I just verified that what I am saying looks like an FB bug. Here is a very simple example that reproduces the bug: create table