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.
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to