Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
87cfb8eb
Commit
87cfb8eb
authored
Aug 10, 2002
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed very stupid but important bug: mixing calls of some founctions from
contrib/tsearch and contrib/ltree :) Teodor Sigaev
parent
be2de3b9
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
21 additions
and
19 deletions
+21
-19
contrib/ltree/README.ltree
contrib/ltree/README.ltree
+3
-1
contrib/ltree/_ltree_gist.c
contrib/ltree/_ltree_gist.c
+3
-3
contrib/ltree/crc32.c
contrib/ltree/crc32.c
+1
-1
contrib/ltree/crc32.h
contrib/ltree/crc32.h
+2
-2
contrib/ltree/ltree.h
contrib/ltree/ltree.h
+1
-1
contrib/ltree/ltree_gist.c
contrib/ltree/ltree_gist.c
+2
-2
contrib/ltree/ltree_io.c
contrib/ltree/ltree_io.c
+1
-1
contrib/ltree/ltxtquery_io.c
contrib/ltree/ltxtquery_io.c
+1
-1
contrib/ltree/ltxtquery_op.c
contrib/ltree/ltxtquery_op.c
+7
-7
No files found.
contrib/ltree/README.ltree
View file @
87cfb8eb
...
...
@@ -426,6 +426,8 @@ appreciate your input. So far, below some (rather obvious) results:
CHANGES
Aug 9, 2002
Fixed very stupid but important bug :-)
July 31, 2002
Now works on 64-bit platforms.
Added function lca - lowest common ancestor
...
...
@@ -437,7 +439,7 @@ July 13, 2002
TODO
* Testing on 64-bit platforms. There are several known problems with byte
alignment;
alignment;
-- RESOLVED
* Better documentation;
* We plan (probably) to improve regular expressions processing using
non-deterministic automata;
...
...
contrib/ltree/_ltree_gist.c
View file @
87cfb8eb
...
...
@@ -45,7 +45,7 @@ hashing(BITVECP sign, ltree *t) {
int
hash
;
while
(
tlen
>
0
)
{
hash
=
crc32_sz
(
cur
->
name
,
cur
->
len
);
hash
=
ltree_
crc32_sz
(
cur
->
name
,
cur
->
len
);
AHASH
(
sign
,
hash
);
cur
=
LEVEL_NEXT
(
cur
);
tlen
--
;
...
...
@@ -455,7 +455,7 @@ gist_te(ltree_gist *key, ltree* query) {
return
true
;
while
(
qlen
>
0
)
{
hv
=
crc32_sz
(
curq
->
name
,
curq
->
len
);
hv
=
ltree_
crc32_sz
(
curq
->
name
,
curq
->
len
);
if
(
!
GETBIT
(
sign
,
AHASHVAL
(
hv
)
)
)
return
false
;
curq
=
LEVEL_NEXT
(
curq
);
...
...
@@ -475,7 +475,7 @@ gist_qtxt(ltree_gist *key, ltxtquery* query) {
if
(
LTG_ISALLTRUE
(
key
)
)
return
true
;
return
execute
(
return
ltree_
execute
(
GETQUERY
(
query
),
(
void
*
)
LTG_SIGN
(
key
),
false
,
checkcondition_bit
...
...
contrib/ltree/crc32.c
View file @
87cfb8eb
...
...
@@ -95,7 +95,7 @@ static const unsigned int crc32tab[256] = {
};
unsigned
int
crc32_sz
(
char
*
buf
,
int
size
)
ltree_
crc32_sz
(
char
*
buf
,
int
size
)
{
unsigned
int
crc
=
~
0
;
char
*
p
;
...
...
contrib/ltree/crc32.h
View file @
87cfb8eb
...
...
@@ -2,9 +2,9 @@
#define _CRC32_H
/* Returns crc32 of data block */
extern
unsigned
int
crc32_sz
(
char
*
buf
,
int
size
);
extern
unsigned
int
ltree_
crc32_sz
(
char
*
buf
,
int
size
);
/* Returns crc32 of null-terminated string */
#define crc32(buf) crc32_sz((buf),strlen(buf))
#define crc32(buf)
ltree_
crc32_sz((buf),strlen(buf))
#endif
contrib/ltree/ltree.h
View file @
87cfb8eb
...
...
@@ -152,7 +152,7 @@ Datum ltree_textadd(PG_FUNCTION_ARGS);
/* Util function */
Datum
ltree_in
(
PG_FUNCTION_ARGS
);
bool
execute
(
ITEM
*
curitem
,
void
*
checkval
,
bool
ltree_
execute
(
ITEM
*
curitem
,
void
*
checkval
,
bool
calcnot
,
bool
(
*
chkcond
)
(
void
*
checkval
,
ITEM
*
val
));
int
ltree_compare
(
const
ltree
*
a
,
const
ltree
*
b
);
...
...
contrib/ltree/ltree_gist.c
View file @
87cfb8eb
...
...
@@ -130,7 +130,7 @@ hashing(BITVECP sign, ltree *t) {
int
hash
;
while
(
tlen
>
0
)
{
hash
=
crc32_sz
(
cur
->
name
,
cur
->
len
);
hash
=
ltree_
crc32_sz
(
cur
->
name
,
cur
->
len
);
HASH
(
sign
,
hash
);
cur
=
LEVEL_NEXT
(
cur
);
tlen
--
;
...
...
@@ -511,7 +511,7 @@ gist_qtxt(ltree_gist *key, ltxtquery* query) {
if
(
LTG_ISALLTRUE
(
key
)
)
return
true
;
return
execute
(
return
ltree_
execute
(
GETQUERY
(
query
),
(
void
*
)
LTG_SIGN
(
key
),
false
,
checkcondition_bit
...
...
contrib/ltree/ltree_io.c
View file @
87cfb8eb
...
...
@@ -333,7 +333,7 @@ lquery_in(PG_FUNCTION_ARGS) {
cur
->
totallen
+=
MAXALIGN
(
LVAR_HDRSIZE
+
lptr
->
len
);
lrptr
->
len
=
lptr
->
len
;
lrptr
->
flag
=
lptr
->
flag
;
lrptr
->
val
=
crc32_sz
((
uint8
*
)
lptr
->
start
,
lptr
->
len
);
lrptr
->
val
=
ltree_
crc32_sz
((
uint8
*
)
lptr
->
start
,
lptr
->
len
);
memcpy
(
lrptr
->
name
,
lptr
->
start
,
lptr
->
len
);
lptr
++
;
lrptr
=
LVAR_NEXT
(
lrptr
);
...
...
contrib/ltree/ltxtquery_io.c
View file @
87cfb8eb
...
...
@@ -154,7 +154,7 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, uint16 flag
if
(
lenval
>
0xffff
)
elog
(
ERROR
,
"Word is too long"
);
pushquery
(
state
,
type
,
crc32_sz
((
uint8
*
)
strval
,
lenval
),
pushquery
(
state
,
type
,
ltree_
crc32_sz
((
uint8
*
)
strval
,
lenval
),
state
->
curop
-
state
->
op
,
lenval
,
flag
);
while
(
state
->
curop
-
state
->
op
+
lenval
+
1
>=
state
->
lenop
)
...
...
contrib/ltree/ltxtquery_op.c
View file @
87cfb8eb
...
...
@@ -13,23 +13,23 @@ PG_FUNCTION_INFO_V1(ltxtq_rexec);
* check for boolean condition
*/
bool
execute
(
ITEM
*
curitem
,
void
*
checkval
,
bool
calcnot
,
bool
(
*
chkcond
)
(
void
*
checkval
,
ITEM
*
val
))
{
ltree_
execute
(
ITEM
*
curitem
,
void
*
checkval
,
bool
calcnot
,
bool
(
*
chkcond
)
(
void
*
checkval
,
ITEM
*
val
))
{
if
(
curitem
->
type
==
VAL
)
return
(
*
chkcond
)
(
checkval
,
curitem
);
else
if
(
curitem
->
val
==
(
int4
)
'!'
)
{
return
(
calcnot
)
?
((
execute
(
curitem
+
1
,
checkval
,
calcnot
,
chkcond
))
?
false
:
true
)
((
ltree_
execute
(
curitem
+
1
,
checkval
,
calcnot
,
chkcond
))
?
false
:
true
)
:
true
;
}
else
if
(
curitem
->
val
==
(
int4
)
'&'
)
{
if
(
execute
(
curitem
+
curitem
->
left
,
checkval
,
calcnot
,
chkcond
))
return
execute
(
curitem
+
1
,
checkval
,
calcnot
,
chkcond
);
if
(
ltree_
execute
(
curitem
+
curitem
->
left
,
checkval
,
calcnot
,
chkcond
))
return
ltree_
execute
(
curitem
+
1
,
checkval
,
calcnot
,
chkcond
);
else
return
false
;
}
else
{
/* |-operator */
if
(
execute
(
curitem
+
curitem
->
left
,
checkval
,
calcnot
,
chkcond
))
if
(
ltree_
execute
(
curitem
+
curitem
->
left
,
checkval
,
calcnot
,
chkcond
))
return
true
;
else
return
execute
(
curitem
+
1
,
checkval
,
calcnot
,
chkcond
);
return
ltree_
execute
(
curitem
+
1
,
checkval
,
calcnot
,
chkcond
);
}
return
false
;
}
...
...
@@ -76,7 +76,7 @@ ltxtq_exec(PG_FUNCTION_ARGS) {
chkval
.
node
=
val
;
chkval
.
operand
=
GETOPERAND
(
query
);
result
=
execute
(
result
=
ltree_
execute
(
GETQUERY
(
query
),
&
chkval
,
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment