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
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
i.e. something like record and arrays
Emill
@Emill
hmm seems like array_agg could solve this too
something like select tbl1.*, array_agg(tbl2) from tbl1 left join tbl2 on tbl1.id = tbl2.tbl1_id group by tbl1.id can be used to list all tbl1 items including all tbl2 items belonging to a tbl1 item
Emill
@Emill
to remove the need for npgsql to know about table type oids, select tbl1.*, array_agg(row(tbl2.id, tbl2.col1, tbl2.tbl1_id)) from tbl1 left join tbl2 on tbl1.id = tbl2.tbl1_id group by tbl1.id can be used to expand tbl2's columns into a generic record that Npgsql can handle
Emill
@Emill
or something more similar like select *, (select array_agg(tbl2) from tbl2 where tbl2.tbl1_id = tbl1.id) from tbl1 to avoid the group by
Shay Rojansky
@roji
Re extension of jsonb, records and arrays specifically seem pretty simple: json already has the concept of arrays, and records are basically heterogeneous arrays too, no?
Yeah, I've looked at array_agg, and also at making it work with EF Core: npgsql/efcore.pg#727, dotnet/efcore#22957
But you're right that the basic problem with this approach, is that a JSON document simply isn't typed in the same way as data coming back directly (in PG binary encoding, decoded by handlers). So handing off the JSON document directly to the user is one thing - it bypasses the ORM capability completely, and it's the user's responsibility to parse and create entity instances out of the JSON, if that's what they want.
Making EF Core actually materialize from JSON would be different, and probably quite problematic (e.g. do we just parse timestamp string representations? What about weirder types?)
Emill
@Emill
Making EF Core materialize data from arrays and records should be simpler, since data is then encoded using the binary types as usual.
My idea was that the user shouldn't need to explicitly ask for array_agg etc. but should be a strategy inside EF to avoid "cartesian explosion" and split query.
If json_agg turns out to be more efficient for some reason than array_agg and row(...), maybe that can be used instead if EF can validate that only text, integers etc. are included in the data to be returned.
Shay Rojansky
@roji
Ah no - you're right that array_agg could indeed be a great PG materialization strategy that avoids cartesian explosion and split query at the same time
It's definitely something that's there in the back of my mind
First EF Core would need to add general support for provider-specific aggregate methods though
In any case, there's no reason to supposed json_agg is better than array_agg - quite the opposite, since parsing the JSON and the textual representation of the values within is useless overhead
Emill
@Emill
Is this materialization strategy something that has been brought up with the MS EF Core team?
Shay Rojansky
@roji
I mentioned it at some point, but the problem is that the array_agg strategy is very PG-specific
This is something that I hope to look at one day, once the provider-specific aggregate function support is done on the EF Core side (the issues above)
Emill
@Emill
it's a very strong feature of PG I would say :)
Shay Rojansky
@roji
Me too :)