Page 1 of 1

Zeos 7.1.3a x PostgreSql 8.1

Posted: 09.09.2014, 12:58
by calico
Hello guys,

when adding fields in ZQuery(add fields) fields with a size of 2 are added with size 4, if 4 = 8 and 50(STRNG) = 200 (MEMO)... each by multiplying the original size of the field.
what is the problem?

Zeos 7.1.3a
PostGreSql 8.1.11 on Debian
DB Encoding - LATIN1
Delphi 7

Thank you for your attention.
Carlos.

Re: Zeos 7.1.3a x PostgreSql 8.1

Posted: 09.09.2014, 21:51
by EgonHugeist
Sure your encoding is LATIN1 and also the TZConnection.ClientCodePage? Do you open a UTF8-encoded connection?

Re: Zeos 7.1.3a x PostgreSql 8.1

Posted: 10.09.2014, 17:24
by calico
Hi EgonHugeist,

Config.
DB Encoding - LATIN1
controls_cp=CP_UTF16
TZConnection.ClientCodePage=LANTIN1

sql exemple
select
a.f1,
a.f2,
...,
cast((select f1 from table where cod = a.cod) as varchar(50)) as field_1 (returns field_1 type 'memo' with 200 positions, not string)
--50 is exactly size of field.
from a
if line write like cast((select f1 from table where cod = a.cod) as varchar(51)) as field_1 (returns field type 'string' but 200 positions not 51)

Tks.

Re: Zeos 7.1.3a x PostgreSql 8.1

Posted: 11.09.2014, 10:00
by EgonHugeist
calico wrote: cast((select f1 from table where cod = a.cod) as varchar(50)) as field_1 (returns field_1 type 'memo' with 200 positions, not string)
--50 is exactly size of field.
Bug of PostgreSQL see http://zeoslib.sourceforge.net/viewtopi ... 38&t=15798
calico wrote: if line write like cast((select f1 from table where cod = a.cod) as varchar(51)) as field_1 (returns field type 'string' but 200 positions not 51)
Sure about it??? Thought the results should be 'T(Wide)Memo' too!

Re: Zeos 7.1.3a x PostgreSql 8.1

Posted: 16.09.2014, 13:24
by calico
I'm Sure.
This result should be TwideString (51) not TWideMemo or TWideString (200), do not know why it multiplies the size.

Re: Zeos 7.1.3a x PostgreSql 8.1

Posted: 16.09.2014, 20:59
by EgonHugeist
The results should be TWideMemo on my PG9.2 not TWideString. As my link describes: This is a bug of PostgreSQL not an issue we can handle correctly.

What i do NOT understand is why you get on second cast a TWideString(200) Field. My PG9.2 returns allways a varchar without a length -> TWideMemo.
No idea how to track that. Is it possible to have multiple instances of PG running?

Edit: Another suggestion..

It might be possible the older servers do reserver some bytes/character. UTF8 needs at least 4 bytes.
What happens if you add "CHARACTERSET LATIN1" to your varchar cast? This is just an idea, i've never tested. Don't know if it works or changes the current behavior..

Re: Zeos 7.1.3a x PostgreSql 8.1

Posted: 19.09.2014, 14:46
by calico
Well, turned par with CAST to VARCHAR (size) and the field editor also put the correct size and it worked!
Tks all !

Re: Zeos 7.1.3a x PostgreSql 8.1

Posted: 19.09.2014, 15:10
by EgonHugeist
What exacly was the solution? What have you done to get it running like you expect it?

Re: Zeos 7.1.3a x PostgreSql 8.1

Posted: 19.09.2014, 15:32
by calico
Select...
cast((select f1 from table where cod = a.cod) as varchar(51)) as field_1 (returs string, but size is wrong)
in fields editor on Delphi changed the size property to 51.
that was the solution at the time.

Tks.