Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 44,763
    • Issues 44,763
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,330
    • Merge requests 1,330
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #30453
Closed
Open
Issue created Jul 26, 2019 by Andreas Brandl@abrandl🌴Contributor

Enforce limit on text columns

Coming from https://gitlab.com/gitlab-org/gitlab-ce/issues/64505, we want to enforce a limit on the length of text data. For string types, this can be done with varchar(N). For the Postgres text type, this can be done with a table CHECK constraint.

The benefit to using text with a CHECK constraint is, that it's straight-forward to change the limit later - without rewriting the whole table. With varchar(N), changing N leads to a rewrite of the table which may be unacceptable.

The proposal here is to:

  • Implement CHECK constraints for limiting the size of text columns
  • Enforce placing a limit on text columns with rubocop
  • Disallow using varchar(N), i.e. string columns in favor of using text always.

From a Postgres perspective, there's only little difference between varchar and text (except the possibility to limit the size of a varchar). Both are varlena types internally and use the same code. There's a good background read comparing textual datatypes.

Assignee
Assign to
Time tracking