Npgsql provides .NET based programs, written e.g. in C#, Visual Basic or F#, access to PostgreSQL databases via ADO.NET.
Questions tagged [npgsql]
13 questions
4
votes
4 answers
Trying to connect to PostgreSQL with Entity Framework via Npgsql and C#
So, I'm new to databases and only have done a little with PostgreSQL before. I have C# (visual studio 2012) and have downloaded the Entity framework (6). I have also downloaded the latest Npgsql data connection driver and used this tutorial:
Using…
Joseph
- 63
- 1
- 1
- 9
4
votes
2 answers
NpgSql - How to pass parameter into DO block in PostgreSQL query
I am trying to use a parameter passed into a PostgreSQL query inside a DO block within that query. It fails though, and seems to be parsing the statement as if the parameter was a column. Is it possible to reference a query parameter in this…
Anssssss
- 248
- 1
- 11
4
votes
2 answers
Postgres 11 - Fetching results after a transactiom
With the recent update of Postgres 11. It now supports procedures. Transactions are finally supported in stored procedures in Postgres. However, I have been trying to perform a transaction and retrieving a refcursor as the result.
CREATE OR REPLACE…
deviantxdes
- 141
- 4
3
votes
0 answers
Npgsql Timeout for simple query when run in parallel
I'm struggling to determine the cause of an exception when the code is run in parallel, but works fine when run one at a time.
As background information, I'm running a set of unit tests, where each test picks up a database from a pool of databases…
berkeleybross
- 175
- 3
- 12
2
votes
0 answers
Postgres: cache lookup failed for type 5308416
When inserting data into a Postgres (timescaledb hyper)table, the following error occurs approximately every 1-5 seconds.
ERROR: cache lookup failed for type 5308416
I'm attempting to find what this type is in order to debug further. I've tried…
Dan
- 71
- 3
2
votes
1 answer
Concurrency / Transaction Concerns with PostgreSQL Copy (bulk insert)
We're building a CQRS system backed by Postgres. As part of this, we generate 'readmodels' which are precalculated projections of event sourced data. We regularly need to create new tables, query event sourced data, calculate a projection and…
Damien Sawyer
- 225
- 1
- 2
- 7
1
vote
1 answer
NpgsqlParameter Array of smallints is receiving 0 instead of null value from postgres
I got strange result with NpgsqlParameter in C++/CLI project.
NpgsqlParameter^ status = wCMD->Parameters->Add(gcnew NpgsqlParameter("param1", NpgsqlDbType::Array | NpgsqlDbType::Smallint));
status->Direction =…
Thanh Dong
- 9
- 3
1
vote
1 answer
How to parameterize a Postgres JSON containment query with arrays of objects?
I have a JSON containment query as below. The query looks for matching objects inside arrays. This works.
The values of Name and DataType will be passed in to a .Net function, and the query built in NpgSql. I want to parameterize the values (city,…
Paul Guz
- 13
- 4
0
votes
0 answers
Postgres / Npgsql slow connection due to Hosts file organisation
I'm not really sure if this is the right place to post this but I happened across a peculiar behaviour yesterday.
Historically, when debugging locally, our application's first connection to a given database (foo.local) has taken quite a long time…
Jmase
- 21
- 2
0
votes
0 answers
How to efficiently do partial updates on huge dataset in Postgresql
Disclaimer: I am a total "newb" in regards to PgSql, but due to some unfortunate aligment of circumstances I am in charge of this project which I have to rewrite/migrate away from SqlServer (alone), so there's that.
The process is fairly…
ConfusedUser
- 1
- 1
0
votes
0 answers
SQL fast in PSQL, very slow using MS.NET driver
There's thread with exact same title and problem, but with no answer, NPGSQL driver takes very long time to execute queries, but other language drivers or terminal works fine.
From what I've found, it's related to parameter sniffing in other SQL…
iNeedHealing255
- 1
- 1
0
votes
1 answer
postgres npgsql DDL statement success or failure
I am using npgsql with a postgres DB, writing a DB updater that will need to execute a series of (usually) DDL statements like "ALTER TABLE ADD COLUMN blah..." and the like. The simple way to do this is with Command.ExecuteNonQuery, however I need…
user4930
0
votes
1 answer
What is the relationship between ADO.NET and Npgsql?
There is a sentence in the Npgsql official page:
Npgsql is an open source ADO.NET Data Provider for PostgreSQL.
I know that I can access a Postgresql database using Npgsql with the .NET framework.
Is Npgsql a subset of ADO.NET or is it derived…
FortisFortuna
- 1
- 2