Skip to content

Tables whose primary keys have zero attributes #113

Closed

Description

@dimitri-yatsenko

Currently datajoint prohibits creating tables with no attributes in the primary key. We can relax this prohibition.

If the primary key has no attributes, it can only have one value. Therefore, the relation can only contain one tuple. So it's good for relations that contain a single fact about the universe rather than a collection of similar facts. The relational algebra using such relations remains identical to what it is now. In particular, joining two relations with no primary key produces another relation with no primary key and one tuple.

Activity

  1. dimitri-yatsenko commented on Jun 30, 2015

    @dimitri-yatsenko
    MemberAuthor

    Note that this is different from SQL's tables that don't have a primary key. SQL is not exactly relational and its tables can contain duplicate rows. SQL does not have the equivalent of a primary key with zero attributes as defined here.

  2. added this to the milestone on Aug 18, 2015
  3. dimitri-yatsenko commented on Sep 10, 2015

    @dimitri-yatsenko
    MemberAuthor

    As @eywalker suggested, one way to think about this topic is to imaging that all tables have an additional attribute _epsilon_ whose domain contains a single value _Omega_. Then a relation with an empty primary key actually has one attribute in the primary key with only one possible value. As such, this relation can contain only one tuple.

  4. removed this from the milestone on Apr 17, 2017
  5. added
    wontfixIndicates that work won't continue on an issue, pull request, or discussion
    and removed on Jul 26, 2017
  6. added this to the Release 0.11 milestone on Jan 17, 2018
  7. dimitri-yatsenko commented on Jan 17, 2018

    @dimitri-yatsenko
    MemberAuthor

    If the primary key is empty, the table can have only one row. It is accomplished by adding an invisible column, defined as

    _  = 1 : tinyint   # universe 
    ---
    

    to the primary key. It cannot be fetched or inserted or updated and is not shown in previews.

  8. austin-hilberg commented on Sep 30, 2018

    @austin-hilberg
    Contributor

    Corresponding issue created for datajoint-matlab

  9. removed this from the Release 0.11 milestone on Oct 11, 2018
  10. 4 remaining items

  11. removed this from the milestone on Aug 1, 2019
  12. changed the title [-]Relations whose primary keys have zero attributes[/-] [+]Tables whose primary keys have zero attributes[/+] on Feb 4, 2020
  13. added this to the milestone on Apr 14, 2020
  14. modified the milestones: , on Oct 7, 2022
  15. added
    enhancementIndicates new improvements
    staleIndicates issues, pull requests, or discussions are inactive
    and removed on Mar 13, 2025
  16. drewyangdev commented on Mar 14, 2025

    @drewyangdev
    Contributor

    This issue is closed because there has been no activity for more than 365 days, please reopen if it's still applicable.

  17. added
    triageIndicates issues, pull requests, or discussions need to be reviewed for the first time
    on Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementIndicates new improvementsstaleIndicates issues, pull requests, or discussions are inactivetriageIndicates issues, pull requests, or discussions need to be reviewed for the first time

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions