Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-10

Reopen issue 20500: TSQLParser cant Parse Statements containing "as"

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers

The issue reporter gave this example:
select ORDERNO as OrderNo from ORDERS as Orders;
It does parse AS, but only for a field.

Michael Van Canneyt replied:
TSQLParser implements SQL syntax as used in Firebird, and firebird does not allow AS for a tablename, just append the alias.

The correct syntax would be:

select ORDERNO as OrderNo from ORDERS Orders;

However:
On my Firebird 2.5, this works perfectly (in FlameRobin and SQLWorkBench/J): select * from rdb$relations as tables;

Would it make sense to reopen this bug?

Thanks,
Reinier

Reply by email

Michael Van Canneyt
to Reinier Olislagers
Reinier Olislagers wrote 17 lines
The issue reporter gave this example: select ORDERNO as OrderNo from ORDERS as Orders; It does parse AS, but only for a field. Michael Van Canneyt replied: TSQLParser implements SQL syntax as used in Firebird, and firebird does not allow AS for a tablename, just append the alias. The correct syntax would be: select ORDERNO as OrderNo from ORDERS Orders; However: On my Firebird 2.5, this works perfectly (in FlameRobin and SQLWorkBench/J): select * from rdb$relations as tables; Would it make sense to reopen this bug?

? Eh ? If indeed it is accepted, then yes please.

Quite strange, because I implemented the SQL parser based on the official Firebird server docs. And it definitely was not allowed.

But I'll test on 2.5, and if it indeed works, I'll of course implement it.

Michael.

Reply by email

Reinier Olislagers
to Michael Van Canneyt
Michael Van Canneyt wrote 10 lines
> Would it make sense to reopen this bug? ? Eh ? If indeed it is accepted, then yes please. Quite strange, because I implemented the SQL parser based on the official Firebird server docs. And it definitely was not allowed. But I'll test on 2.5, and if it indeed works, I'll of course implement it. Michael.

Had a look through the Interbase 6 docs. The description on SELECT indeed mentions column aliases with AS but table aliases without them.

Then the Firebird 2.5 Language Reference Update (8 October 2011, version 1.1, covers Firebird 2.5 and 2.5.1)
http://www.firebirdsql.org/en/news/firebird-2-5-language-reference-update-12296/ doesn't explicitly say anything about table aliases with AS... I'll ask in the Firebird list, maybe the docs need updating.

Note: I didn't open that ticket, so can't reopen it...

Reinier

Reply by email

Reinier Olislagers
to Reinier Olislagers
Reinier Olislagers wrote 19 lines
On 17-10-2011 20:57, Michael Van Canneyt wrote: >> Would it make sense to reopen this bug? > > ? Eh ? If indeed it is accepted, then yes please. > > Quite strange, because I implemented the SQL parser based on the > official Firebird server docs. And it definitely was not allowed. > > But I'll test on 2.5, and if it indeed works, I'll of course implement it. > > Michael. Had a look through the Interbase 6 docs. The description on SELECT indeed mentions column aliases with AS but table aliases without them. Then the Firebird 2.5 Language Reference Update (8 October 2011, version 1.1, covers Firebird 2.5 and 2.5.1) http://www.firebirdsql.org/en/news/firebird-2-5-language-reference-update-12296/ doesn't explicitly say anything about table aliases with AS... I'll ask in the Firebird list, maybe the docs need updating.

Confirmed: the IB 6 Langref needs updating ;) but that probably isn't going to happen.
Firebird docs will be updated though.

See
http://tech.groups.yahoo.com/group/firebird-support/message/115445

Reply by email