Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • cubicweb cubicweb
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 194
    • Issues 194
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cubicweb
  • cubicwebcubicweb
  • Issues
  • #483

Closed
Open
Created Dec 09, 2021 by Nicola Spanti@nspantiMaintainer

Strange exception of RDBMS API on cardinality violation on create

When on an entity type of the schema, cardinality is defined with + (at least one), and that the constraint is violated, we would except an exception that says that the cardinality is violated. Instead of this, it says that the relation of one is not filled !

Example

Schema

class Group(EntityType):
    units = SubjectRelation('GroupItem, cardinality='+?')

Automatic test

def test_group_unit_multiple_create(self):
    with self.admin_access.cnx() as cnx:
        self.create_group(cnx, units=(self.item1_eid,))
        cnx.commit()
        self.create_group(cnx, units=(self.item1_eid,))
        cnx.commit()  # the exception comes from here

Result

yams._exceptions.ValidationError: 9070 (units-subject): at least one relation units is required on Group (9070)

Stack trace

../../.virtualenvs/nemo/lib/python3.7/site-packages/cubicweb/server/session.py:157: in check_open
    return func(cnx, *args, **kwargs)
../../.virtualenvs/nemo/lib/python3.7/site-packages/cubicweb/server/session.py:735: in commit
    operation.handle_event("precommit_event")
../../.virtualenvs/nemo/lib/python3.7/site-packages/cubicweb/server/hook.py:807: in handle_event
    getattr(self, event)()

Versions used

  • CubicWeb 3.32.7
  • RQL 0.37.0
  • YAMS 0.45.3
Edited Dec 09, 2021 by Nicola Spanti
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking