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 21:30
    roji commented #2307
  • Jan 31 20:35
    YohDeadfall commented #2307
  • Jan 31 10:20
    capan starred npgsql/npgsql
  • Jan 31 06:10
    SeanFarrow synchronize #2308
  • Jan 30 20:37
    austindrenski commented #2308
  • Jan 30 20:37
    pentagra commented #1445
  • Jan 30 20:33
    SeanFarrow commented #2308
  • Jan 30 20:31
    austindrenski commented #2308
  • Jan 30 20:27
    SeanFarrow commented #2308
  • Jan 30 20:09
    austindrenski labeled #2308
  • Jan 30 20:05
    roji commented #1520
  • Jan 30 19:50
    gyzod commented #1445
  • Jan 30 19:06
    SeanFarrow commented #1520
  • Jan 30 18:54
    roji commented #1520
  • Jan 30 18:53
    roji commented #1520
  • Jan 30 18:52
    roji commented #2050
  • Jan 30 18:45
    Trolldemorted commented #2050
  • Jan 30 18:21
    SeanFarrow commented #1520
  • Jan 30 18:16
    SeanFarrow review_requested #2308
  • Jan 30 18:16
    SeanFarrow review_requested #2308
Shay Rojansky
@roji
The fixes going into the pool at the moment aren't really supposed to solve connection timeouts (although in extreme cases they may), they're more about reducing contention inside the pool itself.
MedAnd
@MedAnd
Hi @roji - so we did not upgrade the driver recently, believe our pool hit the default max of 100 pooled connections due to load (so not ab-normal per say maybe) however the pool related bugs being worked on in 4.0.9 - npgsql/npgsql#2224 and npgsql/npgsql#2513, wondering if this could be causing our pools to grow to 100 sooner then they need (if that made sense)?
Steven Yeh
@say25
I believe npgsql/npgsql#2492 is ready for review again
Shay Rojansky
@roji
#2224 wouldn't cause your pool to grow - it would cause it not shrink - this may seem a bit subtle but it's important. It just means that in periods of inactivity the pool won't be pruned effectively, and will continue hogging physical connections which should be closed. #2513 is about abnormally high CPU usage when the pool is saturated, which again shouldn't lead to actual connection timeouts. So I wouldn't necessarily look there for an explanation why you're timing out...
@say25 the PR seems to need rebasing, aside from that I promise to review as soon as I can (times are busy...)
Steven Yeh
@say25
@roji done :smile:
csjturbine
@csjturbine

Hi folks was wondering if anyone has run into the following error when compiling on .Net 4.7.2 with NpgSql v4.0.8 : error CS0103: The name 'NpgsqlFactory' does not exist in the current context

I copied the example verbatim located here: https://www.npgsql.org/ef6/index.html and this has been working without error for months. I updgrade NpgSql from 4.0.7 to 4.0.8 and it is now blowing up.

Anybody know why?

Yun Li
@YunLi1988
When I connect to pg11 with npgsql 3.1.1 to run query bellow. Occasionally I got exception of 'System.Text.DecoderFallbackException: Unable to translate bytes [C0] at index -1 from specified code page to Unicode. at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)". Query: "SELECT datname, pid, usesysid, application_name, backend_start, xact_start, query_start, state_change,wait_event_type, wait_event, state, backend_xid, backend_xmin, backend_type FROM pg_stat_activity;"
Does anyone aware of this issue?
Shay Rojansky
@roji
@csjturbine can you please re-confirm? Nothing has really happened between 4.0.7 and 4.0.8 that looks like it could affect something like this...
@YunLi1988 That's odd... This kind of error would occur because of some decoding issue. That particular query (pg_stat_activity) shows what queries are currently executing, so is it possible you have queries which in their SQL have some non-standard characters? More importantly, what encoding is your database in (SHOW server_encoding) and are you setting client_encoding (in the connection string or manually)?
Yun Li
@YunLi1988
@roji thanks for your attention. The query I have again pg_stat_activity have the query text field unselected. Thus the query characters should not affect this query. Is that true? Also I have verified the client encoding is UNICODE and server_encoding is utf8.
Shay Rojansky
@roji
@YunLi1988 yes, excluding the query text should help - although maybe some other field in there could have user-provided text as well, I don't recall...
Yun Li
@YunLi1988
@roji , after adding more logging, I found it is from the backend_type with the null value. It seems npgsql (3.1.10) was unable to recognize the default null value in pg11. Will look more on the default value definition on this field in pg11.
Yun Li
@YunLi1988
@roji it seems to be my side issue, not related with npgsql. Thanks a lot for your help and attention there.
csjturbine
@csjturbine
@roji... my issue appears to be visual studio wierdness. I'm not currently able to duplicatae my issue
Shay Rojansky
@roji
@YunLi1988 ok, thanks for confirming. @csjturbine same!
Alberto Passalacqua
@AlbertoPa
is there a list of what is coming in the EF core provider (3.0 p7)?
Shay Rojansky
@roji
@AlbertoPa if you're referring to general EF Core features in 3.0.0, see https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.0/features. For PostgreSQL-specific stuff, there's no page yet or anything, look at the closed issues mainly: https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues?q=is%3Aopen+is%3Aissue+milestone%3A3.0.0
Krylor
@krylormaximus_twitter
@roji , is there a good example of invoking stored functions with parameters and returning a ResultSet ?
Shay Rojansky
@roji
There's nothing special about stored functions - they're just like a SELECT statement from a table, so you can access the result set in just the same way on NpgsqlDataReader
Alberto Passalacqua
@AlbertoPa
Thank you @roji
I was trying to figure out if there is a plan to support multidimensional types (either arrays or Dictionary) :-)
Shay Rojansky
@roji
IIRC they are supported at the ADO layer (so under EF Core), and there's an issue tracking full support in the EF provider but nobody's shown much interest... What exactly are you trying to do?
Alberto Passalacqua
@AlbertoPa
I have several models where being able to map bi-dimensional types would be very handy. My use cases are a little out of the usual (scientific apps)
Shay Rojansky
@roji
@AlbertoPa the issue tracking multi-dimensional arrays in EF Core is npgsql/Npgsql.EntityFrameworkCore.PostgreSQL#314
Depending on exactly what you want to do, stuff may work. If it's just about mapping properties, it should be there.
Alberto Passalacqua
@AlbertoPa
thank you @roji
I am playing with EF core in the 3.0 preview, and I see issues with "owned" entities. How is one supposed to have them retrieved? It used to be automatic but currently I can't get the values back, even if I explicitly use Include in the EF core query...
Alberto Passalacqua
@AlbertoPa
fixed in nightly builds it seems
Alberto Passalacqua
@AlbertoPa
It looks like asp 3 p8 broke the EF core provider for pg
Alberto Passalacqua
@AlbertoPa

I am playing with EF core in the 3.0 preview, and I see issues with "owned" entities. How is one supposed to have them retrieved? It used to be automatic but currently I can't get the values back, even if I explicitly use Include in the EF core query...

This is fixed now in p8. I have just tested :-)

Shay Rojansky
@roji
You will have to wait for the PG provider to also release p8, you can't mix different versions of EF and of the provider, everything has to be aligned
Alberto Passalacqua
@AlbertoPa
sounds good
Jon Sagara
@jonsagara
I have been playing around with npgsql and EF Core for the first time today, and everything basically just worked, so I wanted to drop a note of thanks to you all for the hard work and quality output. Cheers!
I'm Hoh (To Be A Better Man)
@HohPanat_twitter
how to multi insert into table with c#
Shay Rojansky
@roji
@jonsagara thanks! Wish I had more of those kind of comments :)
@HohPanat_twitter you'll have to provide a bit more details.
Yoh Deadfall
@YohDeadfall
@HohPanat_twitter You can use array of composites or arrays of scalar values. So in the first variant there will be only one parameter and the query will look like INSERT INTO my_table (my_col_1, my_col_2) SELECT * FROM unnest(@rows) AS r (my_value_1, my_value_2).
Using the second way you need to provide multiple parameters, one for each column you're going to insert. The query will be like INSERT INTO my_table (my_col_1, my_col_2) SELECT * FROM unnest(@myValues1, @myValues2) AS r (my_value_1, my_value_2).
Shay Rojansky
@roji
@YohDeadfall I suspect the question is much simpler (e.g. INSERT INTO table (col1, col2) VALUES (1, 2), (3, 4)) but who knows without more details...
Yoh Deadfall
@YohDeadfall
This requires query construction, but in my case there is no concatenations and parameter generation.
In SQL Server the same thing can be achieved via SqlDataRecord collection passed to the server via a single parameter.
nookiepl
@nookiepl
I've started playing with Blazor recently and adapted my side project to use server-side Blazor. I may don't understand something, but I have a function (in injected service in component) which accesses the database (Postgres via the EF Core NPGSQL driver) and returns some data. This function and another, from another service (and component), uses a common feature "GetUserAsync()" which is a standard function of UserManager. If I use both components on the same page I'm getting an error: NpgsqlOperationInProgressException: A command is already in progress: (and here is the SQL query for fetching user data). Does anyone have experience with Blazor and NGPSQL? Every package (Blazor, NPGSQL etc. in the latest preview8 version).
Alberto Passalacqua
@AlbertoPa
@nookiepl how do you inject the service?
the recommended way (at least informally, because guidance should come later) is to inject the service as transient (not scoped, as in MVC)
AlbertoPa @AlbertoPa is very happy of EF with Postgres in p8 :tada:
nookiepl
@nookiepl
That was one of my thoughts, and I tested services as transient, but it still didn’t work. I’ll try today, it was pretty late yesterday, so maybe I messed something. :D
nookiepl
@nookiepl
I've checked this scenario with MS SQL and it seems that there is no problem there. 😢
nookiepl
@nookiepl
Ok, it seems that I forgot to register the whole Identity as transient. After I've registered the whole bunch of services from Identity as transient it's working now - I mean no more exceptions about already running query. Thank you for your help. It's time to consider decoupling Blazor and access data via separate API because I would not say I like the idea to use every database-related service with transient lifetime scope.