ed-o-saurus / PLHaskell

An extension for PostgreSQL that allows embedded Haskell code.
GNU General Public License v3.0
136 stars 2 forks source link

Different lc_messages not allowing to create and execute functions #9

Open sqlambda opened 8 months ago

sqlambda commented 8 months ago

I stumbled into an issue because my server is configured with lc_messages pt_BR.utf8 and it raises an error when creating functions:

ERRO: /lib/x86_64-linux-gnu/libc.so: cabeçalho de ELF inválido

which might be in English something like:

ERROR: /lib/x86_64-linux-gnu/libc.so: invalid ELF header

After changing lc_messages to C, the function is created with success. If I change lc_messages back to pt_BR.utf8 the functions fails to execute with the same error:

daniel=# set lc_messages to default;
SET
daniel=# show lc_messages ;
 lc_messages 
-------------
 pt_BR.utf8
(1 linha)

daniel=# SELECT * FROM primes(100);
ERRO:  /lib/x86_64-linux-gnu/libc.so: cabeçalho de ELF inválido
daniel=# set lc_messages to 'C';
SET
daniel=# SELECT * FROM primes(10);
 n  | p  
----+----
  1 |  2
  2 |  3
  3 |  5
  4 |  7
  5 | 11
  6 | 13
  7 | 17
  8 | 19
  9 | 23
 10 | 29
(10 linhas)

It works with en_US.utf8:

daniel=# set lc_messages to 'en_US.utf8';
SET
daniel=# SELECT * FROM primes(10);
 n  | p  
----+----
  1 |  2
  2 |  3
  3 |  5
  4 |  7
  5 | 11
  6 | 13
  7 | 17
  8 | 19
  9 | 23
 10 | 29
(10 linhas)
ed-o-saurus commented 7 months ago

I've done some investigating. The problem is with the Hint module that is used to interpret Haskell. I've submitted a bug report at [haskell-hint/hint/issues/172]. However, it looks like the issues is with the underlying GHC API. I'll post when I know more.

ed-o-saurus commented 7 months ago

A workaround has been added to the README file.