-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown SQLITE error unsupported type NULL of column #1
#1350
Comments
Looks like this is probably a duplicate of #1246 which was already closed by a PR and should be released in 0.5.7 soon. |
It looks like it might, it being closed would be why I didn't see it, nice! Looking forward then! |
I'm currently experiencing this issue with using sqlx pulled from the master branch, so I don't think #1246 solves this. I get the error any time I return data from the sqlite database. Some examples of simple queries that do this: // I have not figured out a way to suppress the error here
// since casting is not allowed.
sqlx::query!(
r#"INSERT INTO welcome (guild_id, enabled) VALUES (?1, ?2) RETURNING id"#,
data.guild_id.to_string(),
data.enabled)
.fetch_one(&self.pool)
.await?; struct WelcomeModule {
pub id: i64,
pub guild_id: String,
pub enabled: bool,
}
// Ideally I do "SELECT *", but I suppress the error by casting
// SELECT id, guild_id, enabled as "enabled: _"
sqlx::query_as!(
WelcomeModule,
r#"SELECT id, guild_id, enabled FROM welcome WHERE guild_id = ?"#,
guild_id)
.fetch_one(&self.pool)
.await?; These are against a simple table with three columns: CREATE TABLE "welcome" (
"id" INTEGER NOT NULL UNIQUE,
"guild_id" TEXT NOT NULL DEFAULT 0,
"enabled" NUMERIC NOT NULL DEFAULT 0,
PRIMARY KEY("id" AUTOINCREMENT)
); |
Can confirm, I'm getting the error on a fresh
For a migration which looks like: CREATE TABLE population (
battle_id INTEGER NOT NULL,
counted INTEGER NOT NULL,
at_time TIMESTAMP WITH TIME ZONE NOT NULL,
description VARCHAR(150),
last_edited TIMESTAMP WITH TIME ZONE,
submitted TIMESTAMP WITH TIME ZONE NOT NULL,
PRIMARY KEY (battle_id, at_time),
FOREIGN KEY (battle_id) REFERENCES battle(id)
); |
We recently had an overhaul of the typechecking code in the SQLite driver. If anyone can reproduce this issue on 0.6.0, please open a new issue. |
@abonander I am getting similar errors ("unsupported type NULL of column...") in some of my queries: I believe that it is a valid SQL query. I am using sqlx v0.6
|
I believe I might have reproduced something similar to this in #2171 @abonander |
When attempting to perform a
DELETE FROM servers WHERE id = 42 RETURNING name
sqlx is returning an error ofunsupported type NULL of column #1 ("name")
for the given table of:And yet running that same sql via the official sqlite client works correctly and returns the expected value.
The listed version of
libsqlite3-sys
is 0.22.2, which comes bundled with sqlite version 3.35.4 according to the sqlite3 C source included with it, which does support the above SQL, which is confirmed as I installed the same local client version of 3.35.4 and that is what I tested the same above SQL in and it worked there.The specific code that I am using is:
And it fails to compile due to failing the check at compile-time, full error is:
The text was updated successfully, but these errors were encountered: