You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by jsmarks <jm...@salo.com> on 2011/11/01 19:01:49 UTC

JCR_SQL2 joins

Since XPATH is deprecated, I'm trying to learn SQL2 using the data from the
auto populate function off the home page.

Since there are three different primary node types (nt:file, nt:folder,
nt:resource) in the resulting repository, I can't use a single primary node
type in the SQL2. Unfortunately, when I try:

select * from [nt:folder] as fo left outer join [nt:file] as fi on
isdescendantnode(fi, fo)

the error is "This query result contains more than one selector". Trying fo
or fi in place of * tells me I need to supply a selector name.

I conclude from this that one can't query for more than one primary node
type. Am I missing something?

It does not help that I've been unable to find many examples.

--
View this message in context: http://jackrabbit.510166.n4.nabble.com/JCR-SQL2-joins-tp3964627p3964627.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: JCR_SQL2 joins

Posted by Alex Parvulescu <al...@gmail.com>.
Hi,

Actually, it should be able to expand the "*". What version of jackrabbit
are you using?

See [0], [1] for some examples of SQL2 joins.

best,
alex


[0]
http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/JoinTest.java
[1]
http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/SQL2OuterJoinTest.java


On Tue, Nov 1, 2011 at 7:23 PM, Jukka Zitting <ju...@gmail.com>wrote:

> Hi,
>
> On Tue, Nov 1, 2011 at 7:01 PM, jsmarks <jm...@salo.com> wrote:
> > select * from [nt:folder] as fo left outer join [nt:file] as fi on
> > isdescendantnode(fi, fo)
> >
> > the error is "This query result contains more than one selector". Trying
> fo
> > or fi in place of * tells me I need to supply a selector name.
>
> Use "fo.*", "fi.*" or "fo.*, fi.*" instead of "*".
>
> I guess we should make the query parser automatically expand "*" to
> all the properties of all the selectors, but until that's done you
> need to explicitly list the selectors from which you want results.
>
> BR,
>
> Jukka Zitting
>

Re: JCR_SQL2 joins

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Tue, Nov 1, 2011 at 7:01 PM, jsmarks <jm...@salo.com> wrote:
> select * from [nt:folder] as fo left outer join [nt:file] as fi on
> isdescendantnode(fi, fo)
>
> the error is "This query result contains more than one selector". Trying fo
> or fi in place of * tells me I need to supply a selector name.

Use "fo.*", "fi.*" or "fo.*, fi.*" instead of "*".

I guess we should make the query parser automatically expand "*" to
all the properties of all the selectors, but until that's done you
need to explicitly list the selectors from which you want results.

BR,

Jukka Zitting