On 12/23/05, Carlos Moreno <[EMAIL PROTECTED]> wrote: > Marko Kreen wrote: > > >On 12/22/05, Carlos Moreno <[EMAIL PROTECTED]> wrote: > > > >>The problem is, when I execute the SQL statement: > >> > >>create or replace function sha1 .... ; > >> > >>for the second time (i.e., after making modifications and > >>recompiling), the *backend* crashes -- it then restarts > >>automatically, and then I run again the create or replace > >>statement, and it works now (and the function seems to > >>work fine -- well, in its "final" version it does). > >> > > > >You should see if there's something in server log. > > > > The only thing that does show does not seem to say much: > > LOG: server process (PID 12885) was terminated by signal 11 > LOG: terminating any other active server processes > LOG: all server processes terminated; reinitializing > > Not sure what the meaning of signal 11 is with PG (AFAIR, it's > one of the SIGUSER values, right?)
Well, that does not help. Signal 11 is SIGSEGV. > >And then indeed, try to gdb it. You can run Postgres in non-daemon > >mode with command 'postgres -D datadir database'. > > > >The stripped pgcrypto.c you posted - your wrapper function looks fine, > >only problem I see is that you deleted function find_provider that is used > >by pg_digest, so there will be undefined function in final .so. > > > > Oh no!! That was only in the function I posted, so that the file > is kept as short as possible -- in the one that I compiled, I left > everything untouched, and only added my functions. Ah, that's not it. Then I'm clueless. > >But that should not crash the server, so gdb trace could be still useful. > > > > > Ok, will try to do it and post any interesting discoveries (I > can't find any core files, so I guess I'll have to try gdbing it) Core files should be in data directory somewhere. (If postmaster ulimit allows them.) > >>Anyway, I wanted to add hash functions (SHA-1 is already there, > >>so I'd like to add SHA-256 and SHA-512 at the very least, and > >>maybe also, for completeness, SHA-224 and SHA-384). > >> > > > >For SHA2 hashes it should be enough to compile pgcrypto > >against OpenSSL 0.9.8. Or upgrade to PostgreSQL 8.1, > >where they are included. > > > >Ofcourse, that is no fun. > > > > Hahahaha -- why do I keep being naive and making the same mistake > over and over!!! :-) > > As much as it is indeed no fun, it is also good to know (and I > didn't know that OpenSSL 0.9.8 had them either, so thanks for > the double pointer!) Hehe. If hacking on a project, it is usually good to check out the latest version. pgcrypto had a major update in 8.1. > >If you want to hack, you could try adding SHA224 to the SHA2 > >implementation in 8.1. > > > > Sounds like a plan :-) Cool! Look how SHA384 fits in and try to follow that. That way the code is in coherent style. -- marko ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org