Teodor Sigaev wrote: >> Ok. Probably easiest to do that by changing the palloc to palloc0 in >> parse_tsquery. > > and change sizeof to sizeof(QueryItem)
Do you mean the sizeofs in the memcpys in parse_tsquery? You can't change them. The source structs are allocated in pushOperand/pushOperator, using sizeof(QueryOperand/QueryOperator), so if you copy sizeof(QueryItem) bytes from them, you'll copy some random piece of memory. If you just allocate the TSQuery with palloc0, that'll make sure that any memory area not copied into in the loop will be zero. BTW, can you explain what the CRC-32 of a value is used for? It looks like it's used to speed up some operations, by comparing the CRCs before comparing the values, but I didn't quite figure out how it works. How much of a performance difference does it make? Would hash_any do a better/cheaper job? In any case, I think we need to calculate the CRC/hash in tsqueryrecv, instead of trusting the client. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster