ECPG selecting into char arrays

From: Leif Jensen <leif(at)crysberg(dot)dk>
To: pgsql-general(at)postgresql(dot)org
Subject: ECPG selecting into char arrays
Date: 2011-05-19 12:48:40
Message-ID: 21363399.551.1305809320063.JavaMail.root@quick
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi guys,

In version 8.2 of the ECPG documentation, section "31.6.3. Different types of host variables" has been added and includes the following (new) note:

'Note that you have to take care of the length for yourself. If you use this host variable as the target variable of a query which returns a string with more than 49 characters, a buffer overflow occurs.'

This raises a big question about how to handle fields of type 'text' !?

I am pretty sure that in pre-8.0 versions of PostgreSQL ECPG, the arrays were handled in a way that made sure not to write more than the space allowed (why else have the array size and type size included as parameters in the ECPG generated output call to ECPGdo(...) ?). Is this a new "feature" ?

With that note in mind, how do I select from a table field of type 'text' ?

Leif

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-05-19 13:17:28 Re: optimizing a cpu-heavy query
Previous Message Jasmin Dizdarevic 2011-05-19 12:01:30 Re: " FATAL: no pg_hba.conf entry for host" messages...