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

Nullable column cant be filtered #98

Closed
oalpar opened this issue Jun 17, 2024 · 2 comments
Closed

Nullable column cant be filtered #98

oalpar opened this issue Jun 17, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@oalpar
Copy link

oalpar commented Jun 17, 2024

Bug report

Describe the bug

Regression of closed issue #61
A clear and concise description of what the bug is.
nullable model throws exception when using where/filter clause

To Reproduce

[Table("scenes")]
public class Scene : BaseModel
{
	[PrimaryKey("id")]
	public long Id
	{
		get; set;
	}

	[Column("created_at")]
	public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

	[Column("name")]
	public string Name
	{
		get; set;
	}

	[Column("cluster")]
	public long? Cluster
	{
		get; set;
	}

	[Column("ip")]
	public string Ip
	{
		get; set;
	}

	[Column("port")]
	public int Port
	{
		get; set;
	}

	[Column("is_in_use")]
	public bool IsInUse
	{
		get; set;
	}
	[Column("is_dynamic")]
	public bool IsDynamic
	{
		get; set;
	}


	[Column("tick_rate")]
	public float TickRate
	{
		get; set;
	}
}


 long? cluster = null; //var `reference`
var scene= await _client.Postgrest.Table<Scene>().Where(x => x.Name == SceneName && x.IsDynamic == false && x.cluser==cluster).Single();

replicate this statement with a matching entry in the database

Expected behavior

result is returned

real behaviour

exception is thrown
image

  • version postgres 4.0.3
@oalpar oalpar added the bug Something isn't working label Jun 17, 2024
@acupofjose
Copy link
Collaborator

acupofjose commented Jun 17, 2024

Presumably - downgrading to [email protected] fixes your issue?

If so then it looks like our test suite needs to be expanded a bit, because #97 wasn't caught as a regression. Thanks for the heads up!

@oalpar
Copy link
Author

oalpar commented Jun 17, 2024

actually, it seems like it was because i had > 2 conditions in my where statement... #84 same as this issue. The documentation doesn't highlight this limitation at all, and my use case was highlighting both this bug and the previously mentioned nullable bug. So no regression, ill close the topic

@oalpar oalpar closed this as completed Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants