Lazarus
Programming => Databases => Topic started by: cpalx on June 17, 2009, 08:32:50 pm
-
Hello, i am using Lazarus 0.97 (2009-6-16) on windows XP SP3, i have Zeosbb installed to connect to PostgreSQL 8.3 version.
It is working almost perfect, but this query
select fieldone || fieldtwo as data, field2,field3 from aTable
when i use dbgrid to show, it displays (memo) instead of the real data. Others fields display ok
how can i use that query and display good in the dbgrid
-
I had a similar problem with a sqlite database all text fields where displaying as (MEMO), it was fixed by changing the text fields to VARCHAR fields.
Then everything displayed fine.
Don't know if this applies to PostgreSQL but it worked with Sqlite
hope this helps
audio2
-
if you refer to database field (in postgres), my fields are varchar, when i display ine by one it dispplay correctly but when i join them ( || ) then display (memo)
thanks for you replay
-
the reason is that concatinated varchars are seen as one big varchar with size (iirc) > 255.
if your fields are shorter, use a cast:
(field1 || field2)::varchar(sum_of_length_of_both_fields_or enything_else_you_like)
-
thanks, i solved it
select cast ( field1 || field2 as varchar) from table
thanks a lot.
-
Yes,
Use only Varchar for strings in PostgreSQL.