-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
What do you want to change?
The Query message in plugin/codegen.proto has an InsertIntoTable field that gives plugins the parsed target table for INSERT statements. However, there is no equivalent for UPDATE or DELETE queries. That makes me sad! I'd love to be able to know what table is being updated or deleted
Meanwhile, sqlc's compiler already resolves the target table for UPDATE and DELETE internally — it needs to in order to resolve column types in SET clauses and WHERE conditions. The information exists; it's just not wired through to the plugin interface.
Proposed Change
Add two fields to the Query message in protos/plugin/codegen.proto:
protobufmessage Query {
...
Identifier update_table = 9; // new
Identifier delete_from_table = 10; // new
}
These would be populated the same way insert_into_table is — set when the query type is UPDATE or DELETE respectively, nil otherwise.
What database engines need to be changed?
No response
What programming language backends need to be changed?
No response