PosgreSQL Text data type

Tags: #<Tag:0x00007fc0d853c050>


What is a equivalent of PostgreSQL Text data type in Clarion? I assume it is BLOB?

Perhaps depends upon the data being stored. I typically use CSTRING( large#) for comment type fields. Because PG does not have auto type conversion, you often will find TEXT being used where one typically might expect a VARCHAR. This is especially true for columns used with some type of string processing (a concatenation for example) so that a cast::operator is not always required.

It really depends, I’ve used String and Cstring on the clarion side and TEXT on the SQL side.
I’m uncertain if MEMO works? Might be worth a try.

When I first converted, I had STRINGs in the Clarion Dct with TEXT or VARCHAR in PG.
I quickly discovered this was a recipe for frequently storing empty strings in PG which in turn created unexpected problems in PG defined views. I finally decided to bite the bullet and change to CSTRINGs in the Dct. Clarion be damned, a NULL string needs to be a NULL string in PG.

Thank you all for replying.

I know that I can use STRING and CSTRING for queries. But I am wondering what to use when you have a TEXT type column in the database? Where you can have some long text. Since it can be variable length, it does not have defined length as CHAR or VARCHAR, and it can have a greater size than Clarion variables.

Also, the documentation states that there is no performance advantage for CHAR over VARCHAR or TEXT data type, like in other databases.

Quote from https://www.postgresql.org/docs/current/datatype-character.html:


There is no performance difference among these three types, apart from increased storage space when using the blank-padded type, and a few extra CPU cycles to check the length when storing into a length-constrained column. While character(n) has performance advantages in some other database systems, there is no such advantage in PostgreSQL; in fact character(n) is usually the slowest of the three because of its additional storage costs. In most situations text or character varying should be used instead.

I have always used CSTRING(Large#) in the Dct for PG TEXT fields.
Large# = Up to 4MB unless extended using NEW (see docs)

Have never tried MEMO. Using STRING = headaches (for me).