Skip to content

Support caching upserts #31

@netixx

Description

@netixx

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions