Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definition of new operators doesn't work if defined outside :sxql.operator #36

Closed
fisxoj opened this issue Oct 28, 2016 · 0 comments
Closed

Comments

@fisxoj
Copy link
Contributor

fisxoj commented Oct 28, 2016

There are some operators missing from :sxql.operator, so I was trying to use sxql.operator::define-op to add the @@ operator for search in postgres, so I wrote:

(sxql.operator::define-op (:aa sxql.operator::infix-op :sql-op-name "@@"))

Then I was unable to use it in a where clause, it always used the default function application syntax (e.g. @@(field-name plainto_tsquery(?))).

It turns out that this is because, when define-op interns symbols, it doesn't specify a package to intern into, and so it was defining aa-op in :cl-user, then the op wasn't found and used by the query generator.

I know this isn't in the public interface, but it is useful to be able to define operators. I don't know enough about other dialects of sql to know if @@ is supported widely enough to submit a PR to add it to sxql, but maybe just making define-op intern the symbols in :sxql.operator so they are actually usable would be a nice solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant