Martin Pitt [2008-12-02 5:29 -0800]: > Tom Lane [2008-12-01 19:51 -0500]: > > I can't see any reason whatever to not put them into > > ${sharepath}/tsearch_data/. It's not like you're expecting to be > > able to share them with other applications. > > Oh, forgot yesterday, there is one case: the data can be shared > between the 8.3, 8.4, and any future version. (In Debian/Ubuntu you > can install different 8.x versions in parallel) > > But that can easily be achieved in the distro packaging by adding > symlinks, so if you prefer just looking for > ${sharedir}/tsearch_data/system_ll_cc.affix, that would still work for > me.
Right, so I changed the patch accordingly. Thanks, Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
# Description: If a tsearch/stem dictionary is not found in sharedir/tsearch_data/ll_cc.{dict,affix}, fall back to sharedir/tsearch_data/system_ll_cc.{dict,affix}, where postgresql-common creates them from system directories. # Ubuntu: https://launchpad.net/bugs/301770 diff -Nur -x '*.orig' -x '*~' postgresql-8.3/build-tree/postgresql-8.3.5/src/backend/tsearch/ts_utils.c postgresql-8.3.new/build-tree/postgresql-8.3.5/src/backend/tsearch/ts_utils.c --- postgresql-8.3.5/src/backend/tsearch/ts_utils.c 2008-06-19 09:52:31.000000000 -0700 +++ postgresql-8.3.5/src/backend/tsearch/ts_utils.c 2008-12-05 12:48:02.000000000 -0800 @@ -15,6 +15,7 @@ #include "postgres.h" #include <ctype.h> +#include <unistd.h> #include "miscadmin.h" #include "tsearch/ts_locale.h" @@ -36,7 +37,7 @@ const char *extension) { char sharepath[MAXPGPATH]; - char *result; + char *result, *system_result; /* * We limit the basename to contain a-z, 0-9, and underscores. This may @@ -58,6 +59,21 @@ snprintf(result, MAXPGPATH, "%s/tsearch_data/%s.%s", sharepath, basename, extension); + /* fall back to a system-supplied one */ + if (access(result, R_OK) != 0) + { + system_result = palloc(MAXPGPATH); + snprintf(system_result, MAXPGPATH, "%s/tsearch_data/system_%s.%s", + sharepath, basename, extension); + if (access(system_result, R_OK) == 0) + { + pfree(result); + result = system_result; + } + else + pfree(system_result); + } + return result; }
signature.asc
Description: Digital signature