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

Support caching upserts #31

Open
netixx opened this issue Oct 3, 2023 · 0 comments
Open

Support caching upserts #31

netixx opened this issue Oct 3, 2023 · 0 comments

Comments

@netixx
Copy link

netixx commented Oct 3, 2023

While debbugging, I saw that there was

// Check if the given statement looks like a standard Ent query (e.g. SELECT).
	// Custom queries (e.g. CTE) or statements that are prefixed with comments are
	// not supported. This check is mainly necessary, because PostgreSQL and SQLite
	// may execute insert statement like "INSERT ... RETURNING" using Driver.Query.
	if !strings.HasPrefix(query, "SELECT") && !strings.HasPrefix(query, "select") {
		return d.Driver.Query(ctx, query, args, v)
	}

in the code of "Query" in the driver.
If I understand correctly, this means that there is no support for upserts ?

On the top of my mind, I don't see any reason not to cache them. If we see an upsert query with exactly the same query and parameters as we have seen before, returning the same fields, we can use the cached value right ?

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

No branches or pull requests

1 participant