[OpenSIPS-Devel] db_postgres text type should be mapped to DB_STRING

Kiss Karoly kiss.karoly at ephone.hu
Mon Aug 29 10:20:45 CEST 2011


Hello,

I have finally taken the time to create and test the patch for this issue.
The patch itself is very simple, and I don't believe it will create any problems.
The reason for this, is that from postgresql's point of view text and varchar
columns are the same, and varchar handling was already implemented.

It might add a little speedup too, since there is no need for conversion on text
columns when retrieving data from the database, whereas for blobs you need to run a
PQunescapeBytea on every item.

Regards,
Kiss Karoly

On 2011/08/22 13:53, Bogdan-Andrei Iancu wrote:
> Hi Kiss,
> 
> I find your logic flawless, at least from my understanding over postgres.
> 
> You mentioned a patch for this...... ;)
> 
> BTW, in what cases do you use the TEXTOID ?
> 
> Regards,
> Bogdan
> 
> On 08/11/2011 10:28 AM, Kiss Karoly wrote:
> >While debugging a database issue, I ran into the postgresql type to opensips internal type mapping code.
> >In the file modules/db_postgres/res.c around line 153 the postgresql type text is mapped to a blob,
> >which in my opinion is incorrect, since it is listed in the postgresql documentation [1] along with
> >char and varchar. One could argue, that unlike text, varchar is a limited length column, and this is
> >why a text column should be considered blob instead of string. This is also incorrect, since in postgres
> >one can create a column of type varchar without a limit. Well actually the limit is around 1G but that's
> >not the point.
> >My point is, that in the postgresql module TEXTOID should map to DB_STRING in opensips instead of DB_BLOB.
> >
> >What do you think ?
> >
> >[1] http://www.postgresql.org/docs/8.4/interactive/datatype-character.html
> >
> >Regards,
> >Kiss Karoly
> >
> >_______________________________________________
> >Devel mailing list
> >Devel at lists.opensips.org
> >http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
> >
> 
> 
> -- 
> Bogdan-Andrei Iancu
> OpenSIPS eBootcamp - 19th of September 2011
> OpenSIPS solutions and "know-how"
> 
> 
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pg_text_to_db_string.patch
Type: text/x-diff
Size: 499 bytes
Desc: not available
URL: <http://lists.opensips.org/pipermail/devel/attachments/20110829/25bc4be6/attachment.patch>


More information about the Devel mailing list