treat "unlimited varchar" on postgresql as "text"

"W. Haslbeck" <[email protected]>
Newsgroups gmane.comp.lang.4gl.aubit.general
Message-ID <[email protected]>
Hello,

I have a special case where I must treat a PostgreSQL "varchar without 
lenght" as "text" instead of the default varchar(255). Unfortunately 
changing the schema isn't an option because other applications use the 
same schema (and they expect that attributes to be "varchar w/o length").

So I extended the PostgreSQL8 driver lib/libsql/postgresql/pg8.c a bit 
and introduced a new environment variable that controls that behaviour.

Mike, do you mind including that patch in the offical CVS?

wh@lynch:~/AUBIT/build/aubit4glsrc-cvs/lib/libsql/postgresql$ diff -u 
pg8.c.orig pg8.c
--- pg8.c.orig  2013-11-09 22:24:33.483081606 +0100
+++ pg8.c       2013-11-09 22:32:39.746140744 +0100
@@ -1049,7 +1049,15 @@
         }
        else
         {
-         *s = 255;
+          if (A4GL_isyes(acl_getenv("PG_UNLIMITED_VARCHAR_AS_TEXT")))
+            {
+              *d = DTYPE_TEXT;
+              *s = 0x0;
+            }
+          else
+            {
+             *s = 255;
+            }
         }

      }


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.