npgsql

Transaction can't handle parallel commands via Task.WhenAll

混江龙づ霸主 提交于 2020-02-24 10:19:38
问题 I have some main table (like Companies) and a lot of dependent tables (like CompanyAddresses, CompanyPaymentInfos, etc.) in my Postgres DB: CREATE TABLE Companies ( Id uuid NOT NULL PRIMARY KEY, ...); CREATE TABLE CompanyAddresses( CompanyId uuid NOT NULL PRIMARY KEY REFERENCES Companies(Id), ...); CREATE TABLE CompanyPaymentInfos( CompanyId uuid NOT NULL PRIMARY KEY REFERENCES Companies(Id), ...); I use transactions from standard library in my C# code: private TransactionScope

Node is 20x faster Than .NET Core in Connecting to Postgres

末鹿安然 提交于 2020-01-29 13:16:22
问题 I have two servers connecting to a PostgresSQL 9.6 db hosted on Azure. The servers are doing one thing - hitting the Postgres db with a SELECT 1 query every 5 seconds. Typical time to connect to db and get data: Node: 25 MS .NET Core 3.1 using Npsql 4.1.1(I have tried 4.1.2 too, no diff): 500 MS My problem is that my .NET Core app is 20x slower than Node in getting data. I believe .NET Core is not pooling connections for some reason. This slowness occurs with both running the app locally and

Postgresql fails specific query ONE time after Windows reboot

那年仲夏 提交于 2020-01-23 10:46:48
问题 I'm using Postgresql on Windows in a C# application. The problem I'm having is really weird and can be described as follows: I restart my Windows I run the program One specific query fails: SELECT COUNT(*) AS c FROM files WHERE total_bytes IS NOT NULL I run the program again and everything works normally Weird notes: I tried making another query before that one (even using the same table) and it worked: SELECT COUNT(*) AS c FROM files I wasn't able to reproduce the error restarting Postgresql

Postgresql fails specific query ONE time after Windows reboot

与世无争的帅哥 提交于 2020-01-23 10:46:27
问题 I'm using Postgresql on Windows in a C# application. The problem I'm having is really weird and can be described as follows: I restart my Windows I run the program One specific query fails: SELECT COUNT(*) AS c FROM files WHERE total_bytes IS NOT NULL I run the program again and everything works normally Weird notes: I tried making another query before that one (even using the same table) and it worked: SELECT COUNT(*) AS c FROM files I wasn't able to reproduce the error restarting Postgresql

PostGIS query failing due to escape string?

和自甴很熟 提交于 2020-01-16 07:19:27
问题 I have this Postgres/PostGIS query: UPDATE raw.geocoding SET the_geom = ST_Transform(ST_GeomFromText('POINT(((E'-96.6864379495382')::float8) ((E'32.792527154088')::float8))', 4326),3081) WHERE id=((10793455)::int4) When I run it, I get this error: ERROR: syntax error at or near "')::float8) ((E'" LINE 2: ...sform(ST_GeomFromText('POINT(((E'-96.6864379495382')::float8... ^ ********** Error ********** ERROR: syntax error at or near "')::float8) ((E'" SQL state: 42601 Character: 94 I'm

PostGIS query failing due to escape string?

北战南征 提交于 2020-01-16 07:19:20
问题 I have this Postgres/PostGIS query: UPDATE raw.geocoding SET the_geom = ST_Transform(ST_GeomFromText('POINT(((E'-96.6864379495382')::float8) ((E'32.792527154088')::float8))', 4326),3081) WHERE id=((10793455)::int4) When I run it, I get this error: ERROR: syntax error at or near "')::float8) ((E'" LINE 2: ...sform(ST_GeomFromText('POINT(((E'-96.6864379495382')::float8... ^ ********** Error ********** ERROR: syntax error at or near "')::float8) ((E'" SQL state: 42601 Character: 94 I'm

Installing Npgsql.dll for Postgresql

时光毁灭记忆、已成空白 提交于 2020-01-14 19:17:07
问题 So I am having an issue installing npgsql.dll and mono.security.dll. I've been trying to figure this out for so long... please help. Here are the steps I've done... Download zip file from https://github.com/npgsql/npgsql Go into Visual Studio and start new project. C# Command (not sure which specific project I was supposed to create) Create a strong key name Then I try to install the .dll files using gacutil In the zip file I've downloaded in step 1, I cannot find Npgsql.dll and Mono.Security

Installing Npgsql.dll for Postgresql

浪子不回头ぞ 提交于 2020-01-14 19:16:06
问题 So I am having an issue installing npgsql.dll and mono.security.dll. I've been trying to figure this out for so long... please help. Here are the steps I've done... Download zip file from https://github.com/npgsql/npgsql Go into Visual Studio and start new project. C# Command (not sure which specific project I was supposed to create) Create a strong key name Then I try to install the .dll files using gacutil In the zip file I've downloaded in step 1, I cannot find Npgsql.dll and Mono.Security

How to do a PostgreSQL query with where-in clause which contains multiple columns programmatically?

蓝咒 提交于 2020-01-14 02:28:08
问题 My query is like this: select * from plat_customs_complex where (code_t,code_s) in (('01013090','10'),('01029010','90')); It runs well in psql console. My question is how to perform this query in client code.(via C# or Java) And I already know the following code works well(C#): string[] codeT = new string[]{"01013090","01029010"}; connection.Query("SELECT * FROM plat_customs_complex WHERE code_t=ANY(@CodeT)", new { CodeT = codeT }); 回答1: Finally, I found the unnest function can help. Pure SQL

npgsql trouble in c# app - An existing connection was forcibly closed by the remote host

筅森魡賤 提交于 2020-01-13 08:44:59
问题 I am getting the following error when trying to open my Postgresql database from a C# utility: System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host I have tried running this program from a remote computer and from the computer on which the Postgresql server is running. There are no firewalls on either