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

Simplify fetching rows with composite primary keys during backfill #595

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

kvch
Copy link
Contributor

@kvch kvch commented Jan 14, 2025

This PR simplifies the way we put together the WHERE clause of the query we use to fetch rows during the backfilling process. We no longer check the type of the returned identifiers, instead every literal is quoted as before.

I also added a test to check if we can backfilling works properly with composite primary keys.

Closes #582

@kvch kvch changed the title Simplify fetching rows with composity primary keys during backfill Simplify fetching rows with composite primary keys during backfill Jan 15, 2025
@kvch kvch marked this pull request as ready for review January 15, 2025 14:35
@kvch kvch enabled auto-merge (squash) January 15, 2025 14:37
@ryanslade
Copy link
Collaborator

LGTM. Won't approve until @andrew-farries has taken a look because auto merge is enabled.

Copy link
Collaborator

@andrew-farries andrew-farries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good.

#582 is about a problem with a uuid-valued primary key. To close it with this PR we need a test that uses such a table.

@@ -134,13 +134,13 @@ func getIdentityColumns(table *schema.Table) []string {

type batcher struct {
statementBuilder *batchStatementBuilder
lastValues any
lastValues []*string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the type of lastValues be just []string. I don't see where we need the pointer type.

@kvch
Copy link
Contributor Author

kvch commented Jan 15, 2025

I changed the test table to have UUID primary key.

@kvch kvch requested a review from andrew-farries January 15, 2025 16:41
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 this pull request may close these issues.

Panic when attempting to backfill a table with a uuid primary key
3 participants