Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 21:30
    roji commented #2307
  • Jan 31 2019 20:35
    YohDeadfall commented #2307
  • Jan 31 2019 10:20
    capan starred npgsql/npgsql
  • Jan 31 2019 06:10
    SeanFarrow synchronize #2308
  • Jan 30 2019 20:37
    austindrenski commented #2308
  • Jan 30 2019 20:37
    pentagra commented #1445
  • Jan 30 2019 20:33
    SeanFarrow commented #2308
  • Jan 30 2019 20:31
    austindrenski commented #2308
  • Jan 30 2019 20:27
    SeanFarrow commented #2308
  • Jan 30 2019 20:09
    austindrenski labeled #2308
  • Jan 30 2019 20:05
    roji commented #1520
  • Jan 30 2019 19:50
    gyzod commented #1445
  • Jan 30 2019 19:06
    SeanFarrow commented #1520
  • Jan 30 2019 18:54
    roji commented #1520
  • Jan 30 2019 18:53
    roji commented #1520
  • Jan 30 2019 18:52
    roji commented #2050
  • Jan 30 2019 18:45
    Trolldemorted commented #2050
  • Jan 30 2019 18:21
    SeanFarrow commented #1520
  • Jan 30 2019 18:16
    SeanFarrow review_requested #2308
  • Jan 30 2019 18:16
    SeanFarrow review_requested #2308
Yoh Deadfall
@YohDeadfall
@ronnyek, the driver supports ltree starting 5.0.
Weston
@ronnyek
so I should be able to just have a Ltree type property and the ngpsql efcore driver will just work ?
Yoh Deadfall
@YohDeadfall
Probably, am not an EF user, but the driver used under the hood (just Npgsql) passes a string as any of ltree types if the type is specified by its name or NpgsqlDbType.
Therefore, I think it should be fine to provide the required type to EF to make it work (:
Weston
@ronnyek
I'll play with it
Alberto Passalacqua
@AlbertoPa
unrelated question, but I am not finding a way: I have an EF entity which refers to itself recursively an (unknown a priori) number of times. How do I query the whole tree? :-?
Shay Rojansky
@roji
@ronnyek @YohDeadfall re ltree, we only added support at the npgsql level - support would still need to be added to the EF provider. I've opened npgsql/efcore.pg#1592 to track this; just mapping the types is easy enough, but there's also translations for the functions...
akshayjoyinfo
@akshayjoyinfo
Hello, First of all I need to thank such a great lib orm for eg core to do anything possible honorable mentions are jsonb, text[]. Now I need help regarding array column
Tags: text[],
{horror, comedy, drama} this the data how do I search the this tags.colum from .net ef core. Does it support list<string>
context.Movies.Where(et=> et.tags.contains(search_tag)).tolist()?? Is this the way??
akshayjoyinfo
@akshayjoyinfo
Saw this example

class Program
{
static void Main(string[] args)
{
using var ctx = new BlogContext();
ctx.Database.EnsureDeleted();
ctx.Database.EnsureCreated();

    var results = ctx.Blogs.Where(b => b.Tags.Contains("A Value")).ToList();
}

}

public class BlogContext : DbContext
{
public DbSet<Blog> Blogs { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    => optionsBuilder.UseNpgsql("...");

}

public class Blog
{
public int Id { get; set; }
public string[] Tags { get; set; }
}

Is there any way to.do with list??
Shay Rojansky
@roji
There's a PR out just now for full support of List<T> with Contains, which should make it into 5.0.1 (this was planned for 5.0.0 but got left out)
Jeffrey Jones
@rurounijones_gitlab

Could someone check to see I am not doing something stupid here and that this looks like a bug. I am taking the latest Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite as the dependency in my project and it looks like there is a bug somewhere in that dependency tree (Not sure where it would be though).

Am doing a simple select on a table using EFCore syntax and the generated SELECT SQL is including a spurious u.unit_id field that doesn't exist in the table and is not specified in the EFCore model definition. More details in the Gist along with the code: https://gist.github.com/rurounijones/c4adc0b90d4cf47fb3bc480af814a989

Weston
@ronnyek
@YohDeadfall I am looking at the ltree thing... do you know if there is a way to map ltree onto these objects for ef (even if the efcore stuff isnt setup to create queries to appropriately filter execute all thsoe custom sql syntax for that?
eg, should I be able to set a specific type, ahve it stored / loaded from the db, and have to write custom queries, or none of that stuff will work without just a raw pgsqlcommand or something
I would like store tree structure data in postgres and honestly constructing a path like you do in ltree is a lot more convenient than a ton of parent id and funky querying
I'm almost inclined to have same convention for the path, but just use indexes and startswith
Yoh Deadfall
@YohDeadfall
There's no translation in EF, unfortunately, but for now you can write pure SQL for some queries involving type specific functions. @roji may suggest other workarounds.
glestwid
@glestwid
Hi guys, seem to have a bug
2020-12-02 02:57:45.6649| An error occured in queue LP-Siebel-AddClient| Common.RabbitMQ.RabbitQueue`1.OnMessageReceived | Npgsql.NpgsqlException (0x80004005): Received backend message ReadyForQuery while expecting CommandCompleteMessage. Please file a bug.
at Npgsql.NpgsqlConnector.ExecuteInternalCommand(Byte[] data, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnector.Rollback(Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlTransaction.Rollback()
at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Rollback()
Yoh Deadfall
@YohDeadfall
It depends on version you're using. Maybe fixed already.
glestwid
@glestwid

It depends on version you're using. Maybe fixed already.

Npgsql version 5.0, Npgsql.EntityFramework has 5.0 as well

Shay Rojansky
@roji
@glestwid can you open an issue with a runnable code sample for that?
Kieran Benton
@kieranbenton
Hi all, before I log an issue (I've given this a google but nothing recent seems to look similar) I'm getting the following running Npgsql 5, seems to be occurring after a RAISE EXCEPTION in postgres, and where I'm committing the transaction wrapping that raise (I'm not sure if thats semantically the right thing to be doing tbh, but its been like that in previous versions for a number of years):
System.NullReferenceException: Object reference not set to an instance of an object.
at Npgsql.NpgsqlConnector.StartUserAction(ConnectorState newState, NpgsqlCommand command, CancellationToken cancellationToken, Boolean attemptPgCancellation)
at Npgsql.NpgsqlConnector.StartUserAction(CancellationToken cancellationToken, Boolean attemptPgCancellation)
at Npgsql.NpgsqlTransaction.Commit(Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlTransaction.Commit()
Just wanted to check if this is known about before I dig in and try and build a repro? Seems similar to previous issues but those seem to all be cleared in 5?
James Houx
@jhouxzirrus
Just tried to connect to Postgres instance using and received this error: "28000: pg_hba.conf rejects connection for host "192.168.1.1", user "xxx", database "xxx", SSL off"
I used exactly the same credentials for DbBeaver and it connected fine
Any ideas why Postgres might be rejecting an NpgSQL connection attempt but not a DBeaver connection attempt???
I think the problem must stem from the fact that it thinks I'm connecting from 192.168.1.1 -- and honestly I have no idea how it thinks that's my ip address... moreoever, if it thinks that's my IP address, I have no idea how it even sent a response back to me.
James Houx
@jhouxzirrus
I'm on a VPN, which must be somehow causing an issue. DBeaver is accepted but Npgsql is not. hrm
Shay Rojansky
@roji
@kieranbenton don't remember any known issue with an NRE in 5.0, can you open an issue with a code sample?
James Houx
@jhouxzirrus
@roji Shay, would you have any ideas about the problem I described? I don't understand why I can connect from a database application (Dbeaver) just fine, but when I try npgsql, the database rejects it and thinks I'm connecting from 192.168.1.1 (which I'm not!). I can't figure out how this could even be a software issue..... all I have as evidence is that Dbeaver works and npgsql does not
James Houx
@jhouxzirrus
I spoke to my network engineer and he said that due to NAT translation, I really am connecting from 192.168.1.1. So that explains that. But still no idea why I can connect from Dbeaver but not npgsql
James Houx
@jhouxzirrus
@roji ok we finally got it resolved. For some reason Dbeaver must be connecting with SSL even though it says its off. We found that we had to use SSL to get a connection to accept. I added SSL to the connection string, and it fixed the problem
Schmitt Christian
@schmitch
if npgsql efcore would have a jsonb_path_match method, how would that look in c#? JsonbPathMatch(object, string, string) or would it be more like JsonbPathMatch(object, string, object) and the second object param gets translated aswell? i.e. we created a custom method translator in the form of JsonbPathMatch(object, string, string) and are looking to upstream it
usage would be as follow: .Where(p => p.JsonField, "exists($[*] ? (@.id == $id && @.value == $value))", JsonSerializer.SerializeObject())
Mats Israelsson
@mais0375
Is there a way to broadcast local net work to list postessql servers. As for MSSQL ?
Postgressql servers
stephenwood
@stephenwood
Have any of you ever had the following problem? I have a WebApi services that uses Npgsql and that runs in a Kubernetes pod. The service methods use NpgSql to execute Postgres functions. When I alter one of those functions, even if I do it in a way that does not change the function signature, the service starts failing. Restarting the pod immediately fixes the problem. Any ideas why this is happening?
Alberto Passalacqua
@AlbertoPa
I am having an issue when saving an entity with inheritance. The base entity (say A) is common to several objects. I am trying to save B, which inherits from A. However, when doing so, I get an exception because it says a non-null constraint is violated. The issue is that the null constraint is in another entity, C, which inherits from A. Has the behavior changed? This code has worked in 3.x :-?
Alberto Passalacqua
@AlbertoPa
well, this was interesting... the error was caused by a change in how IEquatable shoul be implemented... fixed now
Chuya Guo
@chuyaguo2014

Hi everyone, a newbie question about Npsql 5.0.0

I'm following this tutorial here: http://zetcode.com/csharp/postgresql/ and just using the most basic example where I have a hardcoded connection string and want to print out the version of my local postgres DB.

The program runs successfully if I use 5.0.0-preview1 but fails when I use 5.0.0 with this "Unhandled exception. System.TypeInitializationException: The type initializer for 'Npgsql.TypeMapping.GlobalTypeMapper' threw an exception. ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types." error - could someone please point me in the right direction? How should I configure my connection string for Npsql 5.0.0? thank you very much!

image.png
Here's a screenshot of the error I see
Chuya Guo
@chuyaguo2014
image.png
and this is my dotnet version
image.png