Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-11

Missing (compatible) underlying dataset, can not open

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ramé

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?.

Leonardo M. Ram? Medical IT - Griensu S.A. Av. Col?n 636 - Piso 8 Of. A X5000EPT -- C?rdoba Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19 Cel.: +54 9 (011) 40871877

Reply by email

Michael Van Canneyt
to Leonardo M. Ramé
"Leonardo M. Ram?" wrote 12 lines
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.

Reply by email

Leonardo M. Ramé
to Michael Van Canneyt

El 27/11/14 a las 12:26, Michael Van Canneyt escibi?:

Show quoted text 34 lines
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.

Great Michael!, that worked.

Leonardo M. Ram? Medical IT - Griensu S.A. Av. Col?n 636 - Piso 8 Of. A X5000EPT -- C?rdoba Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19 Cel.: +54 9 (011) 40871877

Reply by email