Skip to content

Logging always reports rows: 0 for inserts #1570

Closed
@jblachly

Description

@jblachly

This affects both Postgresql (what I am seeing) as well as Mysql (which you can see from another user's logs in in e.g. #1366 ). It is likely affecting all backends?

An example:

INSERT INTO projects (id, …; rows: 0, elapsed: 4.623ms

Relevant code is here:

let rows = self.rows;
log::logger().log(
&log::Record::builder()
.args(format_args!(
"{}; rows: {}, elapsed: {:.3?}{}",
summary, rows, elapsed, sql
))
.level(lvl)
.module_path_static(Some("sqlx::query"))
.target("sqlx::query")
.build(),

But I am not sure yet how it is called.

Potentially of interest, psql reports the following on insertion:

db_name=*> insert into projects (name, owner_id) values ('Test transaction', '00000000-0000-0000-0000-000000000000');
INSERT 0 1

(i.e. is it possible sqlx reads the leading zero?)

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