Skip to content

update queries: strange behaviour on SET EXPR #158

Open

Description

@dbu

i tried to run this query:

UPDATE [nt:unstructured] AS a INNER JOIN [nt:unstructured] AS t ON ISCHILDNODE(t, a) 
SET expr('row.getNode("t").setProperty("originalLinkCaption", row.getNode("a").getPropertyValue("originalLinkCaption"))') 
WHERE a.[phpcr:class] = 'Liipch\MagazineBundle\Document\Article' ;

but during the autosave i get the exception

[PHPCR\ValueFormatException] Invalid value for property ")": Object values must implement PHPCR\NodeInterface, PHPCR\PropertyInterface or be \DateTime, supplied argument is of class: PHPCR\Shell\Query\ColumnOperand

as SET EXPR does not exist, this should report an error instead of trying to do strange things. there is probably a problem with the query parser.

Activity

  1. dantleech commented on May 5, 2015

    @dantleech
    Member

    I don't think so.. looks like a parser issue. Maybe try escaping the quotations?

  2. dantleech commented on May 5, 2015

    @dantleech
    Member

    hmm .. i get the same issue

  3. dantleech commented on May 5, 2015

    @dantleech
    Member

    Try:

    UPDATE [nt:unstructured] AS a INNER JOIN [nt:unstructured] AS t ON ISCHILDNODE(t, a) 
    SET t.originalLinkCaption = EXPR('row.getNode("a").getPropertyValue("originalLinkCaption")') 
    WHERE a.[phpcr:class] = 'Liipch\MagazineBundle\Document\Article' ;
  4. dbu commented on May 5, 2015

    @dbu
    MemberAuthor

    i tried that, it leads to the bug described in #160

  5. dantleech commented on May 5, 2015

    @dantleech
    Member

    Hmm, it works for me locally (it parses the query and updates 0 rows). Are you using the latest version? (beta-3)

  6. dbu commented on May 5, 2015

    @dbu
    MemberAuthor
  7. dbu commented on May 5, 2015

    @dbu
    MemberAuthor

    ok, your proposal works. but the thing i reported still gives me the same on beta3 and i don't think i see a typo in there. so maybe a bug in the expression parser?

    functions got case sensitive, so its actually expr and not EXPR

  8. dantleech commented on May 5, 2015

    @dantleech
    Member

    So you can update your content repository sucessfully?

    Is the bug that it should be case insensative? (in addition to actually locating the exception class)

  9. dbu commented on May 5, 2015

    @dbu
    MemberAuthor

    so the SET EXPR() syntax seems not case sensitive, but the a.field = expr() case only works lowercase. maybe that is by design - not sure but maybe functions should generally be case insensitive. would be more in line with the sql keywords being insenstitive.

    a.field = expr() worked for me with beta3. SET EXPR() does not.

  10. dantleech commented on May 5, 2015

    @dantleech
    Member

    Hmm, well SET EXPR is invalid as SET is always field => value. We could implement APPLY EXPR()

  11. dbu commented on May 5, 2015

    @dbu
    MemberAuthor

    oh, but then the parser is really not reporting that one well. it executed something and the error comes on the auto-save. i will adjust the ticket description then

  12. changed the title [-]update queries: EXPR not working[/-] [+]update queries: strange behaviour on SET EXPR[/+] on May 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions