Based on the documentation here: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#i2065646
It would appear that the 'AS' keyword is optional in the places where
the patch would have an affect.
I tested the patch against commit
8b395139f67ddcf7f24443cb6c1d7460e409f639 and appears to correct the
problem.
I've attached a patch, which adds some rudimentary specs for the change.
Thanks,
Wes
On Tue, Nov 25, 2008 at 3:47 AM, Jeremy Evans <[EMAIL PROTECTED]> wrote:
>
> On Nov 23, 10:38 pm, "Wesley Moore" <[EMAIL PROTECTED]> wrote:
>> The code in question from dataset/sql.rb is shown below.
>> to_table_reference calls as_sql if an alias is supplied. The alias is
>> supplied by source_list when selecting from a Dataset. This generates
>> something like: ...FROM (sql) AS "T1". From what I can tell Oracle
>> doesn't support aliasing sub-queries with AS, you just provide the
>> alias E.g. ...FROM (sql) "T1"
>
> I don't use Oracle, so I can't test this, but here's a patch that may
> work. It will omit the use of AS for every case where something is
> aliased, so if there is any case where Oracle requires the use of AS,
> it will break. If that is the case, we'll have to do some
> refactoring. Anyway, please test this patch with the latest master
> branch and let me know if it works.
>
> Thanks,
> Jeremy
>
> diff --git a/lib/sequel_core/adapters/shared/oracle.rb b/lib/
> sequel_core/adapters/shared/oracle.rb
> index f20b24b..425d48d 100644
> --- a/lib/sequel_core/adapters/shared/oracle.rb
> +++ b/lib/sequel_core/adapters/shared/oracle.rb
> @@ -21,6 +21,11 @@ module Sequel
>
> private
>
> + # SQL fragment for specifying an alias. expression should
> already be literalized.
> + def as_sql(expression, aliaz)
> + "#{expression} #{quote_identifier(aliaz)}"
> + end
> +
> def select_clause_order
> SELECT_CLAUSE_ORDER
> end
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
sequel-alias.patch
Description: Binary data
