Access violation on apply updates with 8.4.3

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
danieldavila
Posts: 4
Joined: Mon 17 May 2021 11:40

Access violation on apply updates with 8.4.3

Post by danieldavila » Mon 17 May 2021 14:12

Hello,

We are having a problem with UniDac 8.4.3. If edit a record and after this append a new one, on the apply updates an access violation error appears.

If install Unidac 8.2.4 and do the same test, all the records are saved without erros.
In the test videos i'm just change the installed unidac version, the project and source code are the same.


Test with 8.2.4 no error:
https://drive.google.com/file/d/1dWwzUt ... sp=sharing

Test with 8.4.2 with error:
https://drive.google.com/file/d/1UHHPkn ... sp=sharing

Demo video to reproduce the error:
https://drive.google.com/file/d/1sZyj3I ... sp=sharing

Demo error download
https://drive.google.com/file/d/1O1BZpb ... sp=sharing

Database to reproduce (restore with psql)
https://drive.google.com/file/d/1oQ4Jf3 ... sp=sharing

evgeniym
Posts: 10
Joined: Thu 13 May 2021 07:08

Re: Access violation on apply updates with 8.4.3

Post by evgeniym » Tue 18 May 2021 14:05

Hi Daniel,
Unfortunately, we could not reproduce described issue on our side using your sample. Your test application does not work correctly on our environment. In UniDAC versions 8.4.3 and 8.2.4 the following error appears:
'insert or update on table "sausuari" violates foreign key constraint "fksexusu"’
In order to investigate the issue please compile and send us separate test sample including small test database or scripts to create and fill-in test data structure that will reproduce described error.
You can send these files to us using contact form on our website:
https://www.devart.com/company/contactform.html

Best regards,
Evgeniy

danieldavila
Posts: 4
Joined: Mon 17 May 2021 11:40

Re: Access violation on apply updates with 8.4.3

Post by danieldavila » Tue 18 May 2021 19:15

i've have fixed the problem.
Use the same project, just update the Unit20.pas

Code: Select all

unit Unit20;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Vcl.StdCtrls, Vcl.Grids,
  Vcl.DBGrids, MemDS, DBAccess, Uni, Datasnap.Provider, Datasnap.DBClient,
  UniProvider, PostgreSQLUniProvider;

type
  TForm20 = class(TForm)
    UniConnection1: TUniConnection;
    PostgreSQLUniProvider1: TPostgreSQLUniProvider;
    ClientDataSet1: TClientDataSet;
    DataSetProvider1: TDataSetProvider;
    UniQuery1: TUniQuery;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    btnEdit: TButton;
    btnAppend: TButton;
    btnPost: TButton;
    Button1: TButton;
    procedure btnAppendClick(Sender: TObject);
    procedure btnEditClick(Sender: TObject);
    procedure btnPostClick(Sender: TObject);
    procedure ClientDataSet1AfterPost(DataSet: TDataSet);
    procedure Button1Click(Sender: TObject);
    procedure ClientDataSet1BeforePost(DataSet: TDataSet);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form20: TForm20;

implementation

{$R *.dfm}

procedure TForm20.btnAppendClick(Sender: TObject);
begin
  ClientDataSet1.Append;
end;

procedure TForm20.btnEditClick(Sender: TObject);
begin
  ClientDataSet1.Locate('USUCPF', '05770774908', []);
  ClientDataSet1.Edit;
end;

procedure TForm20.btnPostClick(Sender: TObject);
begin
  ClientDataSet1.Post;
end;

procedure TForm20.Button1Click(Sender: TObject);
begin
  UniConnection1.Open;
  ClientDataSet1.Open;
end;

procedure TForm20.ClientDataSet1AfterPost(DataSet: TDataSet);
begin
  try
    if ClientDataSet1.ApplyUpdates(0) > 0 then
      showmessage('error');
  except
    on e: Exception do
      raise Exception.create(e.Message);
  end;
end;

procedure TForm20.ClientDataSet1BeforePost(DataSet: TDataSet);
begin
  if ClientDataSet1.FieldByName('usutipo').IsNull then
    ClientDataSet1.FieldByName('usutipo').AsInteger := 1;
  if ClientDataSet1.FieldByName('sexcodigo').IsNull then
    ClientDataSet1.FieldByName('sexcodigo').AsInteger := 1;
  if ClientDataSet1.FieldByName('munendere').IsNull then
    ClientDataSet1.FieldByName('munendere').AsInteger := 411850;
  if ClientDataSet1.FieldByName('usuinclus').IsNull then
    ClientDataSet1.FieldByName('usuinclus').AsDateTime := now;
  if ClientDataSet1.FieldByName('ususituac').IsNull then
    ClientDataSet1.FieldByName('ususituac').AsInteger := 0;
  if ClientDataSet1.FieldByName('usupaides').IsNull then
    ClientDataSet1.FieldByName('usupaides').AsInteger := 1;
  if ClientDataSet1.FieldByName('usumaedes').IsNull then
    ClientDataSet1.FieldByName('usumaedes').AsInteger := 1;
  if ClientDataSet1.FieldByName('usudoaorg').IsNull then
    ClientDataSet1.FieldByName('usudoaorg').AsInteger := 0;
  if ClientDataSet1.FieldByName('usutipsan').IsNull then
    ClientDataSet1.FieldByName('usutipsan').AsInteger := 0;
  if ClientDataSet1.FieldByName('usufatrh').IsNull then
    ClientDataSet1.FieldByName('usufatrh').AsInteger := 0;
  if ClientDataSet1.FieldByName('usufreesc').IsNull then
    ClientDataSet1.FieldByName('usufreesc').AsInteger := 0;
  if ClientDataSet1.FieldByName('usuestciv').IsNull then
    ClientDataSet1.FieldByName('usuestciv').AsInteger := 0;
  if ClientDataSet1.FieldByName('usuitiner').IsNull then
    ClientDataSet1.FieldByName('usuitiner').AsInteger := 0;
  if ClientDataSet1.FieldByName('usumigran').IsNull then
    ClientDataSet1.FieldByName('usumigran').AsInteger := 0;
  if ClientDataSet1.FieldByName('usumormun').IsNull then
    ClientDataSet1.FieldByName('usumormun').AsInteger := 0;
  if ClientDataSet1.FieldByName('usupocaun').IsNull then
    ClientDataSet1.FieldByName('usupocaun').AsInteger := 0;
  if ClientDataSet1.FieldByName('usuindnum').IsNull then
    ClientDataSet1.FieldByName('usuindnum').AsInteger := 0;
  if ClientDataSet1.FieldByName('usuindare').IsNull then
    ClientDataSet1.FieldByName('usuindare').AsInteger := 0;

end;

end.

evgeniym
Posts: 10
Joined: Thu 13 May 2021 07:08

Re: Access violation on apply updates with 8.4.3

Post by evgeniym » Wed 19 May 2021 09:21

Hi David,
Please be informed that we were able to reproduce described behavior of UniDAC 8.4.3 and currently investigating it.
I want to assure you that we will immediately inform you once we have the results.

Best regards,
Evgeniy

danieldavila
Posts: 4
Joined: Mon 17 May 2021 11:40

Re: Access violation on apply updates with 8.4.3

Post by danieldavila » Wed 19 May 2021 11:16

Thank's, waiting for the resolution.

jboettinger
Posts: 1
Joined: Fri 28 May 2021 15:08

Re: Access violation on apply updates with 8.4.3

Post by jboettinger » Tue 01 Jun 2021 07:25

When will this be fixed. It is very Critical. When will be a new Release.

danieldavila
Posts: 4
Joined: Mon 17 May 2021 11:40

Re: Access violation on apply updates with 8.4.3

Post by danieldavila » Tue 01 Jun 2021 11:09

jboettinger wrote: Tue 01 Jun 2021 07:25 When will this be fixed. It is very Critical. When will be a new Release.
Here we did the downgrade to 8.2.4 version

evgeniym
Posts: 10
Joined: Thu 13 May 2021 07:08

Re: Access violation on apply updates with 8.4.3

Post by evgeniym » Fri 04 Jun 2021 12:51

Hi David,

Please be informed that we were able to reproduce the issue and fixed it.
This fix will be added to the next build of our product and will be available for all client.
Kindly note that as temp solution, until new build is not released yet, we can provide you with a nightly build which includes this solution.
In order to create this build for you please provide us with your license number and IDE version you are interested in.
For your convenience, you may use the e-support form:
https://www.devart.com/company/contactform.html

Best regards,
Evgeniy

Post Reply