Skip to content

Commit

Permalink
Warn not to create table and use it in the same batch
Browse files Browse the repository at this point in the history
fixes #2182
  • Loading branch information
jackc committed Dec 5, 2024
1 parent e3c81cc commit ac0b46f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,9 @@ func (c *Conn) QueryRow(ctx context.Context, sql string, args ...any) Row {
// SendBatch sends all queued queries to the server at once. All queries are run in an implicit transaction unless
// explicit transaction control statements are executed. The returned BatchResults must be closed before the connection
// is used again.
//
// Depending on the QueryExecMode, all queries may be prepared before any are executed. This means that creating a table
// and using it in a subsequent query in the same batch can fail.
func (c *Conn) SendBatch(ctx context.Context, b *Batch) (br BatchResults) {
if c.batchTracer != nil {
ctx = c.batchTracer.TraceBatchStart(ctx, c, TraceBatchStartData{Batch: b})
Expand Down

0 comments on commit ac0b46f

Please sign in to comment.