Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixes for PostgreSQL 18devel#8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
MarinaPolyakova merged 4 commits intomasterfromPGPRO-12044
Sep 4, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletionsexpected/security_1.out
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
create type si_dicts_result as (dict_name VARCHAR, affix_name VARCHAR, words INT, affixes INT, bytes INT);
create function shared_ispell_dicts( OUT dict_name VARCHAR, OUT affix_name VARCHAR, OUT words INT, OUT affixes INT, OUT bytes INT)
returns SETOF record as $$
declare
qString varchar(4000);
rec si_dicts_result;
begin
qString := 'select * from shared_ispell_dicts()';
for rec in execute qString loop
return NEXT;
end loop;
return;
end
$$ language plpgsql;
create extension shared_ispell;
ERROR: function "shared_ispell_dicts" already exists with same argument types
CONTEXT: SQL statement "CREATE FUNCTION shared_ispell_dicts( OUT dict_name VARCHAR, OUT affix_name VARCHAR, OUT words INT, OUT affixes INT, OUT bytes INT)
RETURNS SETOF record
AS '$libdir/shared_ispell', 'dispell_list_dicts'
LANGUAGE C IMMUTABLE"
extension script file "shared_ispell--1.1.0.sql", near line 26
drop extension if exists shared_ispell;
NOTICE: extension "shared_ispell" does not exist, skipping
drop type si_dicts_result;
drop function shared_ispell_dicts();
create type si_stoplists_result as (stop_name VARCHAR, words INT, bytes INT);
create function shared_ispell_stoplists(OUT stop_name VARCHAR, OUT words INT, OUT bytes INT)
returns SETOF record as $$
declare
rec si_stoplists_result;
qString varchar(4000);
begin
qString := 'select * from shared_ispell_stoplists()';
for rec in execute qString loop
return NEXT;
end loop;
return;
end
$$ language plpgsql;
create extension shared_ispell;
ERROR: function "shared_ispell_stoplists" already exists with same argument types
CONTEXT: SQL statement "CREATE FUNCTION shared_ispell_stoplists( OUT stop_name VARCHAR, OUT words INT, OUT bytes INT)
RETURNS SETOF record
AS '$libdir/shared_ispell', 'dispell_list_stoplists'
LANGUAGE C IMMUTABLE"
extension script file "shared_ispell--1.1.0.sql", near line 31
drop extension if exists shared_ispell;
NOTICE: extension "shared_ispell" does not exist, skipping
drop type si_stoplists_result;
drop function shared_ispell_stoplists();
19 changes: 9 additions & 10 deletionssrc/shared_ispell.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,8 +54,10 @@
#include "storage/ipc.h"
#include "storage/shmem.h"

#include "catalog/pg_collation_d.h"
#include "commands/defrem.h"
#include "tsearch/ts_locale.h"
#include "utils/formatting.h"
#include "access/htup_details.h"
#include "funcapi.h"
#include "utils/builtins.h"
Expand All@@ -80,7 +82,7 @@ static SegmentInfo *segment_info = NULL;
static void ispell_shmem_startup(void);

static char *shalloc(int bytes);
static char *shstrcpy(char *str);
static char *shstrcpy(constchar *str);

static SharedIspellDict *copyIspellDict(IspellDict *dict, char *dictFile, char *affixFile, int bytes, int words);
static SharedStopList *copyStopList(StopList *list, char *stopFile, int bytes);
Expand DownExpand Up@@ -346,13 +348,10 @@ init_shared_dict(DictInfo *info, MemoryContext infoCntx,
dict->useFlagAliases = true;
dict->lenAffixData = info->dict.lenAffixData;
dict->nAffixData = info->dict.nAffixData;
dict->AffixData = (char **) palloc0(dict->nAffixData * sizeof(char *));
dict->AffixData = (constchar **) palloc0(dict->nAffixData * sizeof(char *));

for (i = 0; i < dict->nAffixData; i++)
{
dict->AffixData[i] = palloc0(strlen(info->dict.AffixData[i]) + 1);
strcpy(dict->AffixData[i], info->dict.AffixData[i]);
}
dict->AffixData[i] = pstrdup(info->dict.AffixData[i]);
}

NISortDictionary(dict);
Expand DownExpand Up@@ -395,7 +394,7 @@ init_shared_dict(DictInfo *info, MemoryContext infoCntx,
{
StopListstoplist;

readstoplist(stopFile, &stoplist,lowerstr);
readstoplist(stopFile, &stoplist,str_tolower);

size = sizeStopList(&stoplist, stopFile);
if (size > segment_info->available)
Expand DownExpand Up@@ -613,7 +612,7 @@ dispell_lexize(PG_FUNCTION_ARGS)
if (len <= 0)
PG_RETURN_POINTER(NULL);

txt =lowerstr_with_len(in, len);
txt =str_tolower(in, len, DEFAULT_COLLATION_OID);

/* need to lock the segment in shared mode */
LWLockAcquire(segment_info->lock, LW_SHARED);
Expand DownExpand Up@@ -709,7 +708,7 @@ shalloc(int bytes)
* by the code that reads and parses the dictionary / affixes).
*/
static char *
shstrcpy(char *str)
shstrcpy(constchar *str)
{
char *tmp = shalloc(strlen(str) + 1);

Expand DownExpand Up@@ -821,7 +820,7 @@ copyIspellDict(IspellDict *dict, char *dictFile, char *affixFile, int size, int

/* copy affix data */
copy->dict.nAffixData = dict->nAffixData;
copy->dict.AffixData = (char **) shalloc(sizeof(char *) * dict->nAffixData);
copy->dict.AffixData = (constchar **) shalloc(sizeof(char *) * dict->nAffixData);
for (i = 0; i < copy->dict.nAffixData; i++)
copy->dict.AffixData[i] = shstrcpy(dict->AffixData[i]);

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp