[Lazarus] Missing (compatible) underlying dataset, can not open
Michael Van Canneyt
michael at freepascal.org
Thu Nov 27 16:26:26 CET 2014
On Thu, 27 Nov 2014, "Leonardo M. Ramé" wrote:
> Hi, I'm trying to execute this query, but I'm getting "Missing (compatible)
> underlying dataset, can not open".
>
> lQuery.DataBase := PQConnection1;
> lQuery.ParseSQL:= false;
> lQuery.SQL.Text:= 'select json_agg(resultset) as json from(select 1) as
> resultset';
> lQuery.Open;
>
> The query runs without problems in PostgreSql 9.3 both from pgAdmin and psql.
>
> Any hint?.
Yes:
You are creating a result set with fields that are not recognized by SQLDB (json type).
PQLib (on which pqconnection is based) also does not "understand" json result fields,
it converts them to text.
So, you must somehow typecast the result to string:
Probably
select json_agg(resultset)::text as myjson from(select 1) as resultset
should work.
Michael.
More information about the Lazarus
mailing list