> Well, you didn't add any code, so it's hard to say... Simple ways of > doing what I think you describe will remove the queue's order. Do you > preserve the ordering guarantees? > > Greetings, > > Andres Freund > Yes, the order is preserved. I didn't remove the the original list code. The tree is just an additional access path.
> oldcontext = MemoryContextSwitchTo(CurTransactionContext); > > n = (Notification *) palloc(sizeof(Notification)); > n->channel = pstrdup(channel); > if (payload) > n->payload = pstrdup(payload); > else > n->payload = ""; > n->hash = hash ; > n->left = NULL ; > n->right= NULL ; > *tt = n ; tt is a Notification** obtained by the search. > static Notification **search(const char *channel, const char *payload ) > { > Notification *t,**tt ; > uint32 hash ; > t = hashroot ; > tt = &hashroot ; > hash = hashf(channel,691) ; > hash = hashf(payload,hash) ; > while ( t ) > { > if ( hash < t->hash ) > { > tt = &t->left ; > t = t->left ; > } > else if ( hash > t->hash ) > { > tt = &t->right ; > t = t->right ; > } > else > { > if (0==strcmp(t->channel,channel) && > 0==strcmp(t->payload,payload)) > { > return NULL > } > else > { > tt = &t->left ; > t = t->left ; > } > } > } > return tt ; > } -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers