SQLX: `query_as!()` generating error on Windows

query_as

create table messages(
    id serial primary key,
    user_id uuid not null,
    group_id uuid not null,
    content text not null,
    sent_at timestamptz not null default now(),
    foreign key (user_id) references users(id),
    foreign key (group_id) references groups(id)
);
#[derive(Serialize, Deserialize, Debug)]
pub struct MessageModel {
    pub id: i32,
    pub content: String,
    pub user_id: Uuid,
    pub group_id: Uuid,
    pub sent_at: OffsetDateTime,
}

This specific query among many other queries in the project is causing compilation error.
This issue isn't reproducible on MacOS and Linux (on both all is working fine).
After deleting query code is compiling.
I have no idea if it's my fault or not, but assuming it's only on windows, it's a bug

IIRC query_as! requires you to allow connection to the database while compiling, so that the query syntax can be checked against the actual database schema; is the connection correct?

Alternatively, searching for that error brings up this Open issue `query_file!()` has inconsistent behaviour on Windows · Issue #1494 · launchbadge/sqlx · GitHub, which makes it seem like it might be a carriage return issue on Windows.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.