Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: support tables without a primary key? #2081

Closed
petermattis opened this issue Aug 12, 2015 · 3 comments · Fixed by #3286
Closed

sql: support tables without a primary key? #2081

petermattis opened this issue Aug 12, 2015 · 3 comments · Fixed by #3286
Assignees
Milestone

Comments

@petermattis
Copy link
Collaborator

This could probably be done without too much effort by creating a hidden column that is given a uuid. I'm not sure why we'd want this in practice, though part of the sqllogictest suite uses tables with primary keys which might be reason enough.

@bdarnell
Copy link
Contributor

bdarnell commented Oct 2, 2015

I've downplayed the need for tables without a primary key in the past, but now I think they're worth doing. I've looked at two more SQL test suites that we may want to consider (In python: the dbapi-compliance package and sqlalchemy's dialect test suite), and both use tables without primary keys.

As an alternative to introducing the concept of hidden columns, we might be able to get away with making all of the columns the primary key. This would make the table difficult to alter since you can't change a primary key, but it would be enough for tests.

@petermattis
Copy link
Collaborator Author

Making the primary key all of the columns would be straightforward, though I wonder if any tests rely on being able to insert duplicate rows. A hidden primary key column would not be difficult, especially now that we have default values and unique id generation.

@bdarnell
Copy link
Contributor

bdarnell commented Oct 3, 2015

Having explored this a little further, there are some tests in the sqlalchemy suite that do rely on being able to insert duplicate rows, so a hidden primary key column would be the more compatible solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants