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
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
Chuya Guo
@chuyaguo2014
ah I think I fixed this by changing my dotnet sdk version from 5.0.100 to 5.0.101 🤦🏻‍♀️😅
Björn Harrtell
@bjornharrtell
I use NpgsqlBinaryExporter but do not know the column type at compile time. Using ReadAsync<object>(npgsqlDbType) does not appear to work at all, is that known/intentional?
Björn Harrtell
@bjornharrtell
(i.e only fx. ReadAsync<int>() will work for me)
Elad
@Elad53820332_twitter
Hi, is there a way to use npgsql with .net 4.0 ?
Waldo
@waldo2188
Hi ! I use efcore.pg v3.1.4 and try to build a simple request on a List<string> attribute like explained in the doc ctx.SomeEntities.Where(e => e.SomeArray[0] == 3).ToList();. But Linq it fail with this error message "Sequence contains no elements"
Shay Rojansky
@roji
@waldo2188 we're going to need to see some code - can you post a sample on stackoverflow (tagged npgsql)?
@Elad53820332_twitter no, .NET Framework 4.0 hasn't been supported by Npgsql for a very long time (and is in fact out of support by Microsoft)
@bjornharrtell at least at the moment, you must know the types you're reading out of the COPY API. This limitation is related to how things actually work at the PostgreSQL wire protocol level.
Shay Rojansky
@roji
@schmitch sounds like you're working on jsonpath support (npgsql/efcore.pg#1045). I assume you're referring to the vars parameter, right? If so, since that's a jsonb, it should be an object just like anywhere else - this allows people to pass a JsonDocument, for example. But I suggest you open an issue describing the design you're planning before doing a full implementation, so we can discuss.
Alberto Passalacqua
@AlbertoPa
I am having issues when issuing a SaveChangesAsync() becase Sytem.Text.Json is throwing complaining about cycles even if I am using Newtonsoft on the server. Is there an option to use Newtonsoft also for EF operations?
Shay Rojansky
@roji
@AlbertoPa the EF provider only supports System.Text.Json - but there seems to be at least some support for loops/cycles: https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to?pivots=dotnet-5-0#preserve-object-references-and-handle-loops
Alberto Passalacqua
@AlbertoPa
Thanks @roji. Where can I set the option thought? For regular controller serialization, it is done when adding controllers to the app, and I have the preserve option there. Can I pass the same option to STJ for EF?
Shay Rojansky
@roji
@AlbertoPa you're right that this isn't fully supported yet - see npgsql/efcore.pg#1107. That issue contains a workaround that will probably be sufficient for your case.
Elad
@Elad53820332_twitter
Thanks, I know it's out of support in MS. The problem is that I can't upgrade in the server since the client uses it... So I downgraded to NpgSQL version 2.2 I think the driver will be slower but I can't wait for my client team...
Thanks @roji
Alberto Passalacqua
@AlbertoPa
Thanks @roji I'll give it a try!
I am still not sure how it can fail, because I am reading the json from the DB (a jsonb) column, storing it into another field in another model after just setting values (no structure change to the json), and puff :laughing:
Yousif Touma
@yousiftouma

Hey there. We've updated from EFCore 2.6 -> 3.1 -> 5.0 recently (mid update to 3.1 we decided to go to 5.0 directly, so till running 2.6 in prod) and in the jump from 3.1 -> 5.0, I got this diff in my OnModelCreating (DB-first approach)

  • .HasAnnotation("ProductVersion", "2.2.6-servicing-10079");
  • .HasAnnotation("Relational:Collation", "English_Sweden.1252");

I tried google for info but didn't find anything helpful. Anyone that could fill me in on what this means? Anything I need to test somehow on the prod server?

Yousif Touma
@yousiftouma
sorry, the first dot is supposed to be a negative sign (line removed) and the second a positive sign (line added)
Ihar Peshka
@iharpeshka
Hello everybody
I have issue with npgsql on ubuntu server. My application is running on docker. When I select record with an enum I get an error. Can't cast database type public.language to Int32. On my PC and other servers this is OK