postgres and text field lazarus / 16-Databases ---------------------------------------------------------------------- xinyiman · 2016-03-11 15:05 Hello guys, if I use the text fields of all postgres db components make me see the text (memo). To work around this problem use the query cast (field as varchar (100)) There are other ways to not see the (memo)? ---------------------------------------------------------------------- tsr · 2016-03-11 15:32 You may want to use TDBMemo component. Ewentualy create a calculated text field and write to it in the OnCalcFields method. ---------------------------------------------------------------------- xinyiman · 2016-03-11 15:37 Ok, also use the memo. But what I wish is that I have to show them even with the DBGrid ---------------------------------------------------------------------- miab3 · 2016-03-11 19:10 In the case of ZEOS enough to use: TZConnection.Properties['Undefined_Varchar_AsString_Length'] := xx;  // xx - display size or 'Undefined_Varchar_AsString_Length=xx' in ZConnection Properties Otherwise you must have DbGrid knows how to show contents of MEMO. Michal ---------------------------------------------------------------------- fpcoder · 2016-03-16 19:47 http://wiki.lazarus.freepascal.org/Grids_Reference_Page#Example:_Avoid _displaying_text_fields_as_.22.28Memo.29.22_for_DBGrids or http://forum.lazarus.freepascal.org/index.php/topic,19339.msg196672.ht ml#msg196672 ---------------------------------------------------------------------- tatamata · 2016-03-17 12:31 Right, this inability of Lazarus dbaware components to proeprly handle Postgres text fields is quite annoying and huge drawback. In my case, I had to redesign the whole Postgres database in order to replace text fields with varchar fields. Pain in ass. ---------------------------------------------------------------------- goodname · 2016-03-17 13:22 Recently recalled this procedure for handling PostgreSQL TEXT fields on TDBGrid. The TDBGrid OnPrepareCanvas event contains TColumn information so onGetText events can be assigned when needed. Unfortunately it only works with the TDBGrid data aware control and not the other data aware controls. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.DBGrid1PrepareCanvas(sender: TObject; DataCol: Integer; Column: TColumn; AState: TGridDrawState);begin if Column.Field.DataType=ftMemo then begin  Column.Field.OnGetText:=@DBGridOnGetText; end;end; procedure TForm1.DBGridOnGetText(Sender: TField; var aText: string;  DisplayText: Boolean);begin if DisplayText then aText:=Sender.AsString;end;