Page 1 of 1
PostgreSQL : Can not update this query type
Posted: 22.12.2012, 10:46
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
Posted: 22.12.2012, 11:34
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..
Posted: 22.12.2012, 11:59
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.
Posted: 22.12.2012, 12:08
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.
Posted: 28.12.2012, 08:48
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
Posted: 29.12.2012, 12:52
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.
Posted: 06.01.2013, 09:10
by WorldWalker
Hello,
No, there is no special chars in the table.
MFG
Posted: 08.01.2013, 22:22
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..