on an up-to-date ubuntu 16.04 LTS, using the latest postgres (12.1), and the latest pg_hashids pg_hashids with HASHIDS_VERSION "1.1.3", id_encode segfaults when using a custom alphabet.
postgres=# SHOW server_version;
server_version
----------------------------------
12.1 (Ubuntu 12.1-1.pgdg18.04+1)
(1 row)
These queries work fine:
postgres=# SELECT id_encode(1001);
id_encode
-----------
jNl
(1 row)
postgres=# SELECT id_encode(1234567, 'This is my salt');
id_encode
-----------
Pdzxp
(1 row)
postgres=# SELECT id_encode(1234567, 'This is my salt', 8);
id_encode
-----------
lRPdzxpR
(1 row)
The custom alphabet segfaults:
postgres=# SELECT id_encode(1234567, 'This is my salt', 8, 'abcdef123456789');
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
here's the postgres log
2020-01-15 13:36:54.602 PST [31606] LOG: server process (PID 32146) was terminated by signal 11: Segmentation fault
2020-01-15 13:36:54.602 PST [31606] DETAIL: Failed process was running: SELECT id_encode(1234567, 'This is my salt', 8, 'abcdef123456789');
2020-01-15 13:36:54.602 PST [31606] LOG: terminating any other active server processes
2020-01-15 13:36:54.603 PST [32132] WARNING: terminating connection because of crash of another server process
2020-01-15 13:36:54.603 PST [32132] DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2020-01-15 13:36:54.603 PST [32132] HINT: In a moment you should be able to reconnect to the database and repeat your command.
2020-01-15 13:36:54.605 PST [32264] postgres@postgres FATAL: the database system is in recovery mode
2020-01-15 13:36:54.607 PST [31606] LOG: all server processes terminated; reinitializing
2020-01-15 13:36:54.626 PST [32265] LOG: database system was interrupted; last known up at 2020-01-15 13:32:19 PST
2020-01-15 13:36:54.665 PST [32265] LOG: database system was not properly shut down; automatic recovery in progress
2020-01-15 13:36:54.668 PST [32265] LOG: redo starts at 0/1662F88
2020-01-15 13:36:54.668 PST [32265] LOG: invalid record length at 0/1662FC0: wanted 24, got 0
2020-01-15 13:36:54.668 PST [32265] LOG: redo done at 0/1662F88
2020-01-15 13:36:54.695 PST [31606] LOG: database system is ready to accept connections
on an up-to-date ubuntu 16.04 LTS, using the latest postgres (12.1), and the latest pg_hashids pg_hashids with HASHIDS_VERSION "1.1.3", id_encode segfaults when using a custom alphabet.
These queries work fine:
The custom alphabet segfaults:
here's the postgres log