I've created the following SQL view in my PostgreSql database (have simplified for brevity):
create view "GlossaryView" as
select
(
select cast(
array_agg(
cast(quals as "Qualification")
) as "Qualification"[]
) as "Qualifications"
from
(
select * from "Qualification"
) as quals
);
Qualification
is a table in my database. Running a query against this view locally using psql
works fine.
However, if I run the following query using Dapper:
connection.QueryAsync<dynamic>("select * from \"GlossaryView\" ");
I get the exception in the title, with XYZ
replaced with Qualifications
.
I came across this answer, which suggests using LoadTableComposites=true
in the connection string:
However, when I include this in my connection string in my appsettings.json
file, I get this exception during application startup:
Keyword 'LoadTableComposites ' not supported
Question: How do I get the query working in Dapper? I suspect it's not really Dapper but Npgsql.
Npgsql version: 3.2.6
Edit 1: Here's the Qualification
table structure:
Table "public.Qualification"
Column | Type | Collation | Nullable | Default
--------+------+-----------+----------+---------
Id | uuid | | not null |
Name | text | | |
Indexes:
"PK_Qualification" PRIMARY KEY, btree ("Id")
Referenced by:
TABLE ""User"" CONSTRAINT "FK_User_Qualification_QualificationId"
FOREIGN KEY ("QualificationId") REFERENCES "Qualification"("Id") ON DELETE CASCADE