patternsqlMinor
Can a AWS PostgresSQL RDS instance be provided with a stop words file?
Viewed 0 times
canfilepostgressqlwithwordsprovidedstopinstanceawsrds
Problem
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
Is it possible to do this when using AWS? If no, can the stopwords file be provided over the command line instead?
$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?
Solution
PostgreSQL 10
It does just that, you can see the code here,
There is nothing else in the code base that writes to a
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.
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.
Code Snippets
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;snprintf(result, MAXPGPATH, "%s/tsearch_data/%s.%s",
sharepath, basename, extension);Context
StackExchange Database Administrators Q#102894, answer score: 4
Revisions (0)
No revisions yet.