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
Shay Rojansky
@roji
@lechgu You probably have some sort of docker port exposal (or other network setup) issue. Try to connect with the command-line psql (or just do telnet <host> 5432) from exactly where your application is running
lechgu
@lechgu
yes, I can psql command line successfully from the asp.net container to the postgres container
Matthijs ter Woord
@mterwoord
I have a Postgres 12 server, running in docker. I have 2 other docker conainers both connecting to that postgres server. Somehow recently (probably coinciding with going from a 7 month old pg 11 version to latest v12) connecting means very very slow responses, resulting in timeouts
does anybody have a clue?
Not sure where to look
I can repro it with my docker containers, but also with dbeaver
Any suggestions would be greatly appreciated
Matthijs ter Woord
@mterwoord
something got goofed in my docker images. but now i'm hitting a deadlock situation in the database.Any suggestions on how to find out what's going on?
Shay Rojansky
@roji
@lechgu if you can do psql from exactly the same machine/container to exactly the same machine/container, but can't use Npgsql, then double-check all the connection string details as you probably have some difference. They are virtually doing the same thing.
Richard Drent
@RichardDrent

Hi, have a project with npgsql linq up and running, but the NpgsqlTsVector gives a
"The type or namespace name 'NpgsqlTsVector' does not exist in the namespace 'Microsoft.EntityFrameworkCore'" Error

Anyone a suggestion why?

lechgu
@lechgu
this is just a follow up to my question on npgsql in the docker container. It was a config issue, now my app in asp.net core container happily connects to the postgres in another container. I am using postgress 11
Shay Rojansky
@roji
@lechgu thanks for reporting back!
@RichardDrent NpgsqlTsVector is in namespace NpgsqlTypes, not Microsoft.EntityFrameworkCore
Richard Drent
@RichardDrent
@roji Thanks
Andy Visser
@avisser
Hi all, I'm trying to connect my aspnet core app to an existing postgres db. I had some initial issues with case-sensitivity and I'm 95% sure I fixed those. At this point I get the error, PostgresException: 42P01: relation "AspNetUsers" does not exist; I see the query in my console, SELECT a."Id", a."AccessFailedCount", ... FROM "AspNetUsers" AS a WHERE ((a."NormalizedUserName" = @__normalizedUserName_0) ...
I can run that query successfully from psql. I def have a table "AspNetUsers" with that capitalization. Can anyone suggest the next thing to debug?
lechgu
@lechgu
I would check the capitalization in the asp.net core migration files to see if it is consistent with what is expected.
varun kumar
@varunkumarmnnit
which is better npgsql or devart
for postgres
Shay Rojansky
@roji
@avisser the error seems to suggest that AspNetUsers is properly quoted in the generated SQL. What table exists in your database exactly? I'd guess maybe it's lower-case aspnet?
@varunkumarmnnit they are two "competing" providers. Npgsql is open-source and free, whereas devart is not. Devart also provides ADO providers for other databases, which probably provide better cross-provider compatibility.
Basically it depends on what you need, test both and make an informed decision.
Andy Visser
@avisser
image.png
@roji
But now you made me look at it. I was connecting to the wrong database (an old one where I hadn’t properly done casing). All is well. Thanks community!
Hiroya Kabata
@kbth

When reading a bit type value, I encountered a bug that caused an infinite loop under certain conditions. Please let me know if there is a solution.
For example, the following code will not finish and will continue to run.

using (var conn = new NpgsqlConnection(connnectionString))
{
    conn.Open();

    using (var cmd = conn.CreateCommand())
    {
        cmd.CommandText = @"SELECT 1::bit(100000);";

        using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
        {
            reader.Read();
            reader.GetValue(0); // loop!!
        }
    }
}

The cause is that in BitStringHandler , if a bit value cuts across a buffer boundary the last byte of the cannot be read, resulting in an infinite loop. The buf.ReadBytesLeft property remains at 1 and the loop cannot be escaped.

npgsql/BitStringHandler.cs at dev · npgsql/npgsql · GitHub

Above example is terrible, but our application is facing same problem. It reads 16-bit column values, and cuts across a buffer boundary depending on the data state.

It works if CommandBehavior is the default, but we use Dapper, and Dapper's Query method internally sets CommandBehavior.SequentialAccess.

Dapper / SqlMapper.cs at master · StackExchange / Dapper · GitHub

Is there any solution?

Yoh Deadfall
@YohDeadfall
@kbth Would you mind to open a new issue in the main repo?
Hiroya Kabata
@kbth
@YohDeadfall Sure, I've done npgsql/npgsql#2766 . Please check it.
Evan Raffel
@evman182
So I think I'm having an issue with this npgsql/efcore.pg#899, while calling builder.HasPostgresExtension
since there was no 2.2.5 release to fix this, is there a workaround I can use in 2.2.4
Evan Raffel
@evman182
@roji or @YohDeadfall ?
Shay Rojansky
@roji
@evman182 yeah, you should be able to simply edit your migration and put a null instead of the empty strings - give it a try. If not I'll look more closely.
Joaquin Gonzalez
@JoaquinGonzalez14
Hi, use postgresql 8.4 and npgsql 2.2.7
I do a select and I save the data in an NpgsqlDataReader the data is in it but when I do Read () the data disappears.
please help
Shay Rojansky
@roji
@JoaquinGonzalez14 that doesn't provide any information on what you're actually doing - try opening a question on stackoverflow with a full code sample. Also note that both PG 8.4 and Npgsql 2.2.7 are completely ancient by now.
pm64
@pm64
@eddieparker on 11/11 you were facing an error using Npgsql with Asp.Net Identity: "column 'EmailConfirmed' is of type integer but expression is of type boolean" -- may I ask how you resolved?
Eddie Parker
@eddieparker
@pm64 Oh man, that was a while ago. If I recall, I think I needed to rerun the database upgrade script. I think it was a dotnet command to have it reanalyze my schema and build the upgrade/migration tables. Sorry if that's not helpful.
pm64
@pm64
@eddieparker cool, appreciate the reply
Torstein Auensen
@torshy
Hi! Is the Npgsql.GeoJSON package deprecated? Or is it just missing from the build script to publish a new nuget of it? It's sitting at v1.0 and not compatible with the 4.1.x version of Npgsql as far as i can tell
Nikola
@goors
Can someone maybe help me with this error, I have no idea what it means System.NotSupportedException: Can't infer NpgsqlDbType for type GeoJSON.Net.Geometry.Polygon ?
Yoh Deadfall
@YohDeadfall
@torshy Do you have an exception when using it? The package should work well with versions starting 4.0.0, if there an issue please report.
Will update it soon.
Torstein Auensen
@torshy
Yes there's a missing method exception in GeoJSONHandlerFactory. The Create method has been changed recently-ish
Yoh Deadfall
@YohDeadfall
Ok, thanks!
Yoh Deadfall
@YohDeadfall
@goors Have you used UseGeoJson on a type mapper to register the handler?
emre-aras
@emre-aras
hello
adderlinho
@adderlinho
#2709 Please i need help with that
Lorenzo Delana
@devel0
someone know if npgsql ef core support translating of linq query using first_agg function ?
Shay Rojansky
@roji
@devel0 I don't see first_agg in the list of PostgreSQL aggregate functions (https://www.postgresql.org/docs/current/functions-aggregate.html), is that some custom function you created?
Norbert Haberl
@nhaberl
@roji regarding Prepare() would it be ok to use events like OnExecutingCommand (in PetaPoco) to set Prepar() before executing ...
The other way around would be to collect all sql statements (almost selects) and add them prepared directly on the server? So is Prepare() really so important or lets say beneficial ?
CRGorman
@CRGorman
Greetings, I'm trying to connect to a Postgres server using both a certificate and a key file. For details, here is the question on Stack Overflow: https://stackoverflow.com/questions/59829513/npgsql-provide-client-certificate-and-key
Please note I cannot set the Key/Cert to enviroment variables.