Re: Do PostgreSQL have map and set structure(like STL in C++)?

Поиск
Список
Период
Сортировка
От Andrey Borodin
Тема Re: Do PostgreSQL have map and set structure(like STL in C++)?
Дата
Msg-id FF3A6B25-AE3C-4936-A87D-C39966259E46@yandex-team.ru
обсуждение исходный текст
Ответ на Do PostgreSQL have map and set structure(like STL in C++)?  ("梦旅人" <liubaozhu1258@qq.com>)
Ответы Re: Do PostgreSQL have map and set structure(like STL in C++)?  (Thomas Munro <thomas.munro@gmail.com>)
Список pgsql-hackers
Hello Liu!

> 21 апр. 2019 г., в 17:32, 梦旅人 <liubaozhu1258@qq.com> написал(а):
>    I want to add a feature in PostgreSQL, and I need use map structure and set structure(like STL in C++). Do
PostgreSQLhave realized these structures? Where can I find the functions? 
>     What I need in the code is just like this:
>     map<char*, set<char*> >
>     set<char*>

You can use HTAB at utils/hsearch.h [0]

It is Larson's dynamic hashing, implementation is in backend/utils/hash/dynahash.c
Mostly like unordered_map. Accordingly, it lacks lower bound functionality as sorted sets do.

Also, you can user RB-tree in lib/rbtree.h [1] It's usual red-black tree.

Best regards, Andrey Borodin.


[0] https://github.com/postgres/postgres/blob/master/src/include/utils/hsearch.h
[1] https://github.com/postgres/postgres/blob/master/src/include/lib/rbtree.h


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fabien COELHO
Дата:
Сообщение: Re: Do PostgreSQL have map and set structure(like STL in C++)?
Следующее
От: David Fetter
Дата:
Сообщение: [PATCH v1] Add \echo_stderr to psql