Skip to content
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

Very weired query, both true or false can no t be get out #2889

Closed
OpenJarvisAI opened this issue Feb 12, 2024 · 2 comments
Closed

Very weired query, both true or false can no t be get out #2889

OpenJarvisAI opened this issue Feb 12, 2024 · 2 comments

Comments

@OpenJarvisAI
Copy link

Hi, i have a simple query:

Stream<List<DbMessage>> getPinedMsgByRoomId(String roomId) {
    return (select(messages)
          ..where((tbl) => tbl.roomId.equals(roomId) & tbl.pin.not())
          ..orderBy([
            (t) => OrderingTerm(expression: t.sendTime, mode: OrderingMode.desc)
          ]))
        .watch();
  }

which get the pined message out, I tried with or without not(), nothing queried out.

my table defines like this:

class Messages extends Table {
 BoolColumn get pin => boolean().withDefault(const Constant(false))();
  BoolColumn get favo => boolean().withDefault(const Constant(false))();
  IntColumn get theme => integer().withDefault(const Constant(0)).nullable()();
}

I am not very confused.

it at least be pinned or not piined, but none of them queried out any data.

@simolus3
Copy link
Owner

Just to be sure - rows are returned without the & tbl.pin.not() (so there are messages in the room you're querying)?
As far as I know, the only way for tbl.pin and tbl.pin.not() to both return no rows is if the column is NULL. But since the column is not defined as nullable in Messages, that's unlikely too.

@OpenJarvisAI
Copy link
Author

Oh, my fault, I just make mistake on ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants