Postgresql – Can a AWS PostgresSQL RDS instance be provided with a stop words file

amazon-rdsfull-text-searchpostgresql

I need to provide a custom list of stop words. From the manual section on dictionaries the way to do this is to put a stopwords file in $SHAREDIR/tsearch_data/.

Is it possible to do this when using AWS? If no, can the stopwords file be provided over the command line instead?

Best Answer

PostgreSQL 10

It does just that, you can see the code here,

void
readstoplist(const char *fname, StopList *s, char *(*wordop) (const char *))
{
    char      **stop = NULL;

    s->len = 0;
    if (fname && *fname)
    {
        char       *filename = get_tsearch_config_filename(fname, "stop");
        tsearch_readline_state trst;
        char       *line;
        int         reallen = 0;

**stop could be modified easily to read from the yet-nonexistant parameters, but currently it just pulls from the file. A few lines above and you'll find get_tsearch_config_filename(fname,extension) which looks in just the place you were referring too,

snprintf(result, MAXPGPATH, "%s/tsearch_data/%s.%s",
         sharepath, basename, extension);

There is nothing else in the code base that writes to a StopList pointer. As of PostgreSQL 10, it's not possible.

Amazon RDS

There is an unresolved issue from 2014 on AWS Developer for this,

Amazon confirms we're right in saying there is no way

Unfortunately, because RDS doesn't provide filesystem access, you won't be able to upload your custom files to $SHAREDIR.

And Amazon follows up with

I have raised a feature request with the RDS team.