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@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@lists.opensips.org > http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Index: modules/db_postgres/res.c =================================================================== --- modules/db_postgres/res.c (revision 8341) +++ modules/db_postgres/res.c (working copy) @@ -146,11 +146,11 @@ case CHAROID: case VARCHAROID: case BPCHAROID: + case TEXTOID: LM_DBG("use DB_STRING result type\n"); RES_TYPES(_r)[col] = DB_STRING; break; - case TEXTOID: case BYTEAOID: LM_DBG("use DB_BLOB result type\n"); RES_TYPES(_r)[col] = DB_BLOB;
_______________________________________________ Devel mailing list Devel@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/devel