Friday, May 10, 2013

Using Tree behavior with Postgres database

Hi all,

I am using Postgres for the first time and I am running into problems when using the Tree behavior on my Page model.  I am familiar with the Tree behavior and have used it many times with MySQL so I know my pages table is set up correctly.

I can insert new records and the lft, rght and parent_id fields appear to be updating OK, but when I run the recover() function on the tree, or I try to use moveUp() or moveDown() I get an error from a specific query:

ERROR:  column "Page.lft" must appear in the GROUP BY clause or be used in an aggregate function
                                                             ^
In statement:
SELECT MAX("Page"."rght") AS "rght" FROM "public"."pages" AS "Page" WHERE 1 = 1 ORDER BY "Page"."lft" ASC LIMIT 1

Anyone encountered this before or know of a solution?

Thanks very much,

Alex

--
Alex Bovey
Web Developer | Alex Bovey Consultancy Ltd
Registered in England & Wales no. 6471391 | VAT no. 934 8959 65
alex@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533
PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate