[Groonga-commit] pgroonga/pgroonga at afc24f3 [master] Fix a crash bug when primary key column isn't the first column

Zurück zum Archiv-Index

Kouhei Sutou null+****@clear*****
Wed Aug 2 10:03:33 JST 2017


Kouhei Sutou	2017-08-02 10:03:33 +0900 (Wed, 02 Aug 2017)

  New Revision: afc24f3c2c9ad469ba107579581a6fd4e6a94a33
  https://github.com/pgroonga/pgroonga/commit/afc24f3c2c9ad469ba107579581a6fd4e6a94a33

  Message:
    Fix a crash bug when primary key column isn't the first column
    
    GitHub: fix #50
    
    Reported by tedypranolo. Thanks!!!

  Added files:
    expected/full-text-search/text/single/score/primary-key/not-head.out
    sql/full-text-search/text/single/score/primary-key/not-head.sql
  Modified files:
    src/pgroonga.c

  Added: expected/full-text-search/text/single/score/primary-key/not-head.out (+22 -0) 100644
===================================================================
--- /dev/null
+++ expected/full-text-search/text/single/score/primary-key/not-head.out    2017-08-02 10:03:33 +0900 (32daa2d)
@@ -0,0 +1,22 @@
+CREATE TABLE memos (
+  content text,
+  id int PRIMARY KEY
+);
+CREATE INDEX pgroonga_index ON memos
+ USING pgroonga (id, content);
+INSERT INTO memos (id, content) VALUES (1, 'PostgreSQL is a RDBMS.');
+INSERT INTO memos (id, content) VALUES (2, 'Groonga is fast full text search engine.');
+INSERT INTO memos (id, content) VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga.');
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = off;
+SELECT id, content, pgroonga.score(memos)
+  FROM memos
+ WHERE content &@~ 'PGroonga OR Groonga';
+ id |                        content                        | score 
+----+-------------------------------------------------------+-------
+  3 | PGroonga is a PostgreSQL extension that uses Groonga. |     2
+  2 | Groonga is fast full text search engine.              |     1
+(2 rows)
+
+DROP TABLE memos;

  Added: sql/full-text-search/text/single/score/primary-key/not-head.sql (+21 -0) 100644
===================================================================
--- /dev/null
+++ sql/full-text-search/text/single/score/primary-key/not-head.sql    2017-08-02 10:03:33 +0900 (76c553a)
@@ -0,0 +1,21 @@
+CREATE TABLE memos (
+  content text,
+  id int PRIMARY KEY
+);
+
+CREATE INDEX pgroonga_index ON memos
+ USING pgroonga (id, content);
+
+INSERT INTO memos (id, content) VALUES (1, 'PostgreSQL is a RDBMS.');
+INSERT INTO memos (id, content) VALUES (2, 'Groonga is fast full text search engine.');
+INSERT INTO memos (id, content) VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga.');
+
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = off;
+
+SELECT id, content, pgroonga.score(memos)
+  FROM memos
+ WHERE content &@~ 'PGroonga OR Groonga';
+
+DROP TABLE memos;

  Modified: src/pgroonga.c (+1 -1)
===================================================================
--- src/pgroonga.c    2017-07-28 22:54:18 +0900 (437806d)
+++ src/pgroonga.c    2017-08-02 10:03:33 +0900 (4d10a97)
@@ -2821,7 +2821,7 @@ PGrnPrimaryKeyColumnsInit(slist_head *columns,
 				primaryKeyColumn->type =
 					desc->attrs[primaryKeyNumber - 1]->atttypid;
 				primaryKeyColumn->domain = PGrnGetType(primaryKeyIndex,
-													   primaryKeyNumber - 1,
+													   i,
 													   &(primaryKeyColumn->flags));
 				primaryKeyColumn->column = grn_obj_column(ctx,
 														  so->sourcesTable,
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index