Thread: How portable are the POSIX.2 regular expression routines?
Anyone have an opinion on the portability of the regular expression functions defined in POSIX 1003.2, http://www.opengroup.org/onlinepubs/007908799/xsh/regcomp.html ? In particular, do you know of any platforms we support that don't have them? The reason I'm asking is that to convert pg_regress into C code we need some regex functionality, and the easiest way to get that would be to assume that the C library has it ;-). In Magnus's draft patch he assumed that we could link src/backend/regex/* into pg_regress, but I think that's a really bad way to go. Even though that code is mostly independent of the rest of the backend at the moment, it seems highly unlikely that we'll keep it so forever --- regc_locale.c in particular needs to tie into whatever solution we wind up using for general locale support. Plan B would be to kluge up some quick-and-dirty code to handle just the small subset of regex syntax that we actually use in resultmap ... regards, tom lane
Tom Lane wrote: >Anyone have an opinion on the portability of the regular expression >functions defined in POSIX 1003.2, >http://www.opengroup.org/onlinepubs/007908799/xsh/regcomp.html >? In particular, do you know of any platforms we support that don't >have them? > >The reason I'm asking is that to convert pg_regress into C code >we need some regex functionality, and the easiest way to get that >would be to assume that the C library has it ;-). In Magnus's >draft patch he assumed that we could link src/backend/regex/* >into pg_regress, but I think that's a really bad way to go. >Even though that code is mostly independent of the rest of the >backend at the moment, it seems highly unlikely that we'll keep >it so forever --- regc_locale.c in particular needs to tie into >whatever solution we wind up using for general locale support. > >Plan B would be to kluge up some quick-and-dirty code to handle >just the small subset of regex syntax that we actually use in >resultmap ... > > > Does Windows come with POSIX regex libs? I would be a bit surprised. When we discussed this at the conference I suggested to Magnus that he not use regexes. When I did initdb I originally looked at using a regex library, and realised that we really wouldn't need them, and the tiny replacement routines I wrote would be sufficient. So I would be tempted to go for Plan B. Plan C might be to assume that we have sed available, just as we are assuming we have diff available. BTW, we I am pretty sure we *do* need MAX_CONNECTIONS it really shouldn't be too hard to implement. cheers andrew
Andrew Dunstan <andrew@dunslane.net> writes: > Tom Lane wrote: >> Anyone have an opinion on the portability of the regular expression >> functions defined in POSIX 1003.2, > Does Windows come with POSIX regex libs? I would be a bit surprised. > When we discussed this at the conference I suggested to Magnus that he > not use regexes. When I did initdb I originally looked at using a regex > library, and realised that we really wouldn't need them, and the tiny > replacement routines I wrote would be sufficient. All we really need is something that can handle patterns including ".*", because that's all that is used in the patterns in "resultmap". That should be doable (inefficiently, but who cares) in just a few lines of code. I'll go for Plan B for the moment. > BTW, we I am pretty sure we *do* need MAX_CONNECTIONS it really > shouldn't be too hard to implement. Yeah, I thought the same --- you need it on a platform that won't let you run dozens of processes under one userid. Will take care of it. regards, tom lane
From: "Tom Lane" <tgl@sss.pgh.pa.us> > Andrew Dunstan <andrew@dunslane.net> writes: >> Tom Lane wrote: >>> Anyone have an opinion on the portability of the regular expression >>> functions defined in POSIX 1003.2, > >> Does Windows come with POSIX regex libs? I would be a bit surprised. > >> When we discussed this at the conference I suggested to Magnus that he >> not use regexes. When I did initdb I originally looked at using a regex >> library, and realised that we really wouldn't need them, and the tiny >> replacement routines I wrote would be sufficient. +1 for B. I think so too. I covered the logic of Slonik of Slony-I again. It was just for Windows. > > All we really need is something that can handle patterns including ".*", > because that's all that is used in the patterns in "resultmap". That > should be doable (inefficiently, but who cares) in just a few lines of > code. I'll go for Plan B for the moment. It is the thing of several lines and being supported will be great, even if it is the limited object. Probably, result will be made equal on all platforms.:-) Regards, Hiroshi Saito