Skip to content
New issue

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

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

Already on GitHub? # to your account

Replace column index usage with attnums and Column model id #839

Closed
6 tasks done
silentninja opened this issue Nov 23, 2021 · 5 comments
Closed
6 tasks done

Replace column index usage with attnums and Column model id #839

silentninja opened this issue Nov 23, 2021 · 5 comments
Labels
pr-status: revision A PR awaiting follow-up work from its author after review work: backend Related to Python, Django, and simple SQL

Comments

@silentninja
Copy link
Contributor

silentninja commented Nov 23, 2021

Problem

Column index that is being used now is not robust and has few bugs related to its usage. For example db.constraints.operations.select.get_column_constraints will break if columns have been deleted, this comment explains the why attnums are robust identifiers

Proposed solution

PR #658 introduces the Column model which uses attnum, a robust alternate to column index. Hence column model id should be used at the service layer and attnum should be used in the place of column index at the data layer(db module)

We need to make at least the following changes:

Additional context

@mathemancer
Copy link
Contributor

I think the db layer identifier for the column should be the attnum, and the mathesar service layer should map between the column id used in the API and the attnum used by the database.

@kgodey kgodey added ready Ready for implementation and removed needs: unblocking Blocked by other work labels Nov 24, 2021
@kgodey
Copy link
Contributor

kgodey commented Nov 24, 2021

Marking as ready since the prerequisite work has been merged.

@silentninja
Copy link
Contributor Author

@kgodey Should these be part of the Initial data type milestone or improvements as the broken down issues seem to be part of improvements?

@kgodey
Copy link
Contributor

kgodey commented Jan 25, 2022

@silentninja nice catch, I moved the broken down issues to Initial Data Types as well. I think it makes sense there since we're expanding the usage of columns through display options in that milestone.

@kgodey
Copy link
Contributor

kgodey commented Jun 2, 2022

This is done.

@kgodey kgodey closed this as completed Jun 2, 2022
Repository owner moved this from Waiting to Done in [NO LONGER USED] Mathesar work tracker Jun 2, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
pr-status: revision A PR awaiting follow-up work from its author after review work: backend Related to Python, Django, and simple SQL
Projects
No open projects
Development

No branches or pull requests

3 participants