Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    Thanks for this suggestion. Maybe I'm missing something, but I need to enforce "exactly one per group", not "at most one per group"... Commented Jan 28, 2015 at 19:16
  • 1
    I've edited the answer. Commented Jan 28, 2015 at 19:26
  • Thanks again, and sorry for being such a pest. After studying your answer I realized that my post was not sufficiently clear on one point. I have edited my post to remedy this. In particular, I think that the NOT NULL clause in the principal_xid INTEGER NOT NULL spec does not hold in this case. I apologize for the confusion. Commented Jan 28, 2015 at 20:36
  • @kjo No worries, I was afraid that that might be the case. Editing the answer to fix. Commented Jan 28, 2015 at 20:39
  • @ypercube: Your design is good. In the second scenario, inserting in x and y_x can be a bit challenging with the circular references. Data-modifying CTEs may be the best solution. Commented Jan 28, 2015 at 22:55