On Thursday, March 23, 2017 at 12:56:12 PM UTC-7, Andrew Burleson wrote:
>
> Hi Jeremy,
>
> I use the symbol splitting feature a lot, but always in the specific
> situation of a query where I need to specify a table name on a column, eg. `
> user.id` rather than just `id`.
>
> The shorthand is nice in that case, but I agree it's a bit of an odd
> behavior and I can understand how it leads to lots of buggy edge cases.
>
> Would it be practical to add an alternative -- or perhaps this already
> works -- of just using strings? eg.
>
> foo.join('users.id' => 'id')
>
In most cases in Sequel, ruby strings are treated as SQL strings, so this
wouldn't work. There are a few cases where an SQL string is not valid
where Sequel will treat a ruby string as an SQL identifier, but Sequel
quotes identifiers by default, so you can't use . inside a string for a
qualified identifier. You can do Sequel.lit('users.id') to drop down to
literal SQL, but that limits Sequel's introspection capabilities.
> That, or perhaps the symbolized equivalent ( `:"users.id"`) would solve
> pretty much every use of symbol splitting for me.
>
That also doesn't work because Sequel quotes identifiers by default.
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.