PostgreSQL : Can not update this query type

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
WorldWalker
Junior Boarder
Junior Boarder
Posts: 25
Joined: 10.10.2009, 18:57

PostgreSQL : Can not update this query type

Post by WorldWalker »

Hi all,
First of all I'd like to thank for your nice work.
I am using a Run Time Fields control creation from TZQuery+TDatasource both created at design time.
e.g.: I create a TDBEdit for every character varying field retrieved from the metadata.
I'm receiving the 'Can not update this query type' when I try to post after editing a record.
I found in ZeosDBO Change Notes that its a random bug with PostgreSQL and it seems it was fixed since 6.5.
I'm using Lazarus 1.0.2,Postgres 8.4.1, Zeos 7.0.1
Thanks
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

WorldWalker,

this error happens if the table name can't be determined:

Code: Select all

function TZGenericCachedResolver.DefineTableName: string;
var
  I: Integer;
  Temp: string;
begin
  Result := '';
  for I := 1 to Metadata.GetColumnCount do
  begin
    Temp := ComposeFullTableName(Metadata.GetCatalogName(I),
      Metadata.GetSchemaName(I), Metadata.GetTableName(I));
    if (Result = '') and (Temp <> '') then
      Result := Temp
    else if (Result <> '') and (Temp <> '') and (Temp <> Result) then
      raise EZSQLException.Create(SCanNotUpdateComplexQuery);
  end;
  if Result = '' then
    raise EZSQLException.Create(SCanNotUpdateThisQueryType);
end;
can you give me an example, please?

You can also use the TZUpdateSQL Component to handle complex queryies like joins over several tables..
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
WorldWalker
Junior Boarder
Junior Boarder
Posts: 25
Joined: 10.10.2009, 18:57

Post by WorldWalker »

EgonHugeist,
Thank you very much for your quick reply and your support, as you said the error is related to the missed table name and raised within
TZGenericCachedResolver.DefineTableName
TZAbstractDataset.InternalUpdate
Anyway TZUpdateSQL solves the problem, despite the query is a simple SELECT * FROM foo.
If I you want me to debug further more, or If you want a simple project with a create script please let me know, I'll try to do it asap.
Special thanks.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

WorldWalker,

no problem. I try to support where i can.

It would be very nice if you can attach a simple template app, which points me to this issue. Each closed leak is a good leak (((:

Thanks in advance.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
WorldWalker
Junior Boarder
Junior Boarder
Posts: 25
Joined: 10.10.2009, 18:57

Post by WorldWalker »

Hello,
Well I found some difficulties to give the step by step guide to reproduce the bug, as it's a part of complexe code and I didn't found the easiest way to extract the methode as it's a part of many different units, and while doing that I found that the problem only occurs on Windows plateform (vista32) but disappears on Linux (Mint32). Could this be a Lazarus dependent plateform bug?
Tested with Postgres 8 and 9.
Thanks
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

WorldWalker,
Could this be a Lazarus dependent plateform bug?
We had such spezial issues previously. It might be possible but without more informations i can't say your suggestion is right or wrong. *Nix systems are UTF8-Based and Windows isn't. Is it posible your selected table uses some spezial chars?

Anyway thanks for the hint to a plattform spezial issue.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
WorldWalker
Junior Boarder
Junior Boarder
Posts: 25
Joined: 10.10.2009, 18:57

Post by WorldWalker »

Hello,
No, there is no special chars in the table.
MFG
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

WorldWalker,

well that's frustrating. Like you wrote it seems to be a random issue. Did you think about a little demo application? If i can see an issue then i hope i can help..
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Locked