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
Mats Israelsson
@mais0375
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
akshayjoyinfo
@akshayjoyinfo

Hi All, its my first time here in the Group,
I have question about replicating data into two different tables

Consider this example

  1. I am getting some BookingData from one of the api as json => I am saving the data in the Table1 as
    Id - Pk Bigint
    UniqueID- unique string value
    data - jsonb
    these data I need to sent to other parties I can simply dump json and sent to others

  2. Also once step completed I need these data need to be filtered from my UI application, which meanas i need to use normalized tables
    Table2, Table3, Table4 with Pk-FK tables

question is it okay to write the data into diffrent places in tow different formats, so that my read or UI/API can be much easy to have complete filters
or
do I need to live with single table normalize all data, when you send again group together and sent to othres..

tell me whihc is option is good?
for me writing two places, so that UI/others can rely on the data..

Shay Rojansky
@roji
@iharpeshka check that you're using the same Npgsql version on both machines - otherwise you're going to have to submit a code sample
@akshayjoyinfo this channel is for asking questions about the Npgsql driver (and the EF Core provider), rather than to discuss what your database schema looks like... I'd recommend posting a question on stackoverflow
akshayjoyinfo
@akshayjoyinfo
yeah sure will do that.
mm3141
@mm3141
Hi, is there some expression tree mapping for EFCore with npgsql mapping to array concatenation ( || operator)?
Stanislav
@sflusov
Hello guys,
Could you look why some links on you site have been stop worked on the, i.e.
William Denton
@williamdenton
Hi @roji , we have run into this bug in production npgsql/npgsql#3469
can you advise when 5.0.3 will be released to nuget? We are debating wether to revert our upgrade to ef5/npqsql5 or wait for the patch. We can realistically wait no more than 24 hours before we have to revert so we can continue shipping features on our service
William Denton
@williamdenton
hm, that sentence doesn't quite read right... we have deployed an old version of our microservice from before the upgrade to restore service. the revert is referring to the Pull Request we would need to revert internally to undo the net5 updates. Our preference would be to roll forward with the new drivers than undo it all and try agin later
Yoh Deadfall
@YohDeadfall
I think nothing block us from release, but I would like to see npgsql/npgsql#3402 merged first. @roji ?
William Denton
@williamdenton
thanks @YohDeadfall we will revert our upgrade and try again soon.
Shay Rojansky
@roji
@sflusov you can find these under https://www.npgsql.org/doc/types/datetime.html etc. (go to the site root and navigate from there)
Shay Rojansky
@roji
FYI I've release 5.0.3. It doesn't contain npgsql/npgsql#3402 as that issue still has some design issues/questions around it.
James
@pha3z
I am working on a POCO generator that reads Postgres DDL and generates .NET POCO. I see NpgSql's documentation defines the Postgres to .NET mapping. Is there a method or methods available in Npgsql where I could say "GetDotNetTypeForPostgresType(string postgresType)" and be returned a string of the mapped dotnet type?
FWIW: I did try to hunt through the source.. but I wasn't finding it.
Yoh Deadfall
@YohDeadfall
@pha3z, there are two ways to get it: per connection TypeMapper or global GlobalTypeMapper, both a connection properties. Later look at Mappings and ClrTypes for each of them.
Emill
@Emill
Entity Framework can create pretty complex (blown-up) queries with many joins for LINQ-queries that requests data to be returned in something similar to a big json-structure. Those queries get quite complex resultset layout and due to the heavy use of joins data can easily be duplicated many times when sent over the wire. The json-functions in PostgreSQL can be used to return the data in a json-structure instead, which will be more on the form what the user wants, and hence not include any duplicate data. Can Entity Framework Core take advantage of this?
Shay Rojansky
@roji
@Emill general JSON support is one of the specific themes being looked at for EF Core 6.0 - not just for PG (other databases also have good JSON capabilities). We've specifically discussed projecting data out of the database as a JSON document, it's indeed a very interesting direction. But right now nothing like that is supported. Note that EF also has split query mode, which mitigates a lot of the issues with many joins in a single query (https://docs.microsoft.com/en-us/ef/core/querying/single-split-queries)
Emill
@Emill
I wonder how to deal with fields that are not representable by json though
I'd like to see an extension of jsonb that could be used with arbitrary postgresql data types