Jump to content

Integrity Constraint Violation When Adding Child Page [Solved]


Macrura
 Share

Recommended Posts

we have a site with a parent page called "sessions" and child pages that hold information about class sessions for a school.

there are 491 sessions there now and when a user tries to add a new session, the 492nd one is failing with the following error:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '492-1664' for key 'name_parent_id'

we can delete some child pages, add some, and as long as we don't get up to the 492nd one, we're ok, but we can't get past that 492nd child page...

the child pages are being managed by the new pro-fields pagetable; it has all been working fine until today; not sure if this has anything to do with pagetables; users can add pages directly, or from the page that handles the pagetable; this is accomplished with a page select on the child page and a module that adds the child page to the page table field after that page select is populated...

but adding child pages either way from the parent page on the pagetable, or directly adding a page in the tree, it always is failing on the 492..

___

OOPS... this has been solved - had to look through the database and sure enough there was a page with the name 492, and when creating a new page the system was trying to temp name the new page to 492...

long story short, i need to set some required fields and add more checking and validation to the page names..

Edited by Macrura
  • Like 3
Link to comment
Share on other sites

more facepalm.. my own module was naming the next page with the count of all child pages +1... just remembered this!

have added unix date string to the end of the auto-naming for the child pages which should solve the unique-ness issue...

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...