Issue with TEXT type

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
user8
Posts: 4
Joined: Fri 22 Oct 2010 06:56

Issue with TEXT type

Post by user8 » Fri 22 Oct 2010 07:20

Hello Devart Team,

We are experiencing an issue using PgDac 2.0 with Delphi XE.

We have a postgresql database that includes a table with a TEXT field.

We set this field using a PgTable ...

Code: Select all

 
MyTable.FieldByName('MyTEXTField').AsString := 'Hello word' 
But then in the database we can read 'Hello wor'
The last character is missing.

The behaviour seems to be different with Varchar and TEXT types ?
Before we used PgDac 1.20.0.19 with Delphi 2010 and it worked with the TEXT type.

Best regards

user8
Posts: 4
Joined: Fri 22 Oct 2010 06:56

Post by user8 » Fri 22 Oct 2010 07:32

The Postgres version is 8.4.4

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 22 Oct 2010 10:06

Hello,

I could not reproduce the problem.
I have created a table like

CREATE TABLE test
(
text_field text
)
WITH (OIDS=FALSE);
ALTER TABLE test OWNER TO postgres;

and inserted a value like

PgTable1.Open;
PgTable1.Append;
PgTable1.FieldByName('text_field').AsString:= 'Hello word';
PgTable1.Post;

and in PgAdmin I can see the correct value.

I have tested it with Delphi XE, PgDAC 2.00.0.1, PostgresSQL 8.4.1 and 9.0.

Please send a script to create the table.

user8
Posts: 4
Joined: Fri 22 Oct 2010 06:56

Post by user8 » Mon 25 Oct 2010 07:20

Hello AlexP and thank you for your reactivity.

I made some investigation. I created the same table as you. I created a small test application that just inserts value like you :

Code: Select all

  PgTable1.Open;
  PgTable1.Append;
  PgTable1.FieldByName('text_field').AsString:= Edit1.text;
  PgTable1.Post;
I can reproduce the bug only if UseUnicode is checked in the options of TPgConnection and indeed, in my main application, this option is checked since I manage unicode strings in the application and also in the database.

Did you check this option?

Best regards,

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 25 Oct 2010 09:51

Hello,

We have reproduced the problem.
But it arises only in Delphi XE, in other Delphi versions the values are inserted correctly even with the UseUnicode option enabled.
We will notify you as soon as we have any results.

user8
Posts: 4
Joined: Fri 22 Oct 2010 06:56

Post by user8 » Mon 25 Oct 2010 11:39

OK, thank you.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 26 Oct 2010 07:34

Hello,

This problem is connected with the fact that the UnicodeToUtf8 procedure was modified in XE for the cross-platform development sake.
(https://forums.embarcadero.com/message. ... eID=276790).
We fixed it, this fix will be included in the next build of PgDAC.

Post Reply