Re: Why is create function bringing down the Backend server? - Mailing list pgsql-general

From Marko Kreen
Subject Re: Why is create function bringing down the Backend server?
Date
Msg-id e51f66da0512221309t58ce32d9o3c47c478b611fbff@mail.gmail.com
Whole thread Raw
In response to Why is create function bringing down the Backend server?  (Carlos Moreno <moreno_pg@mochima.com>)
Responses Re: Why is create function bringing down the Backend server?
List pgsql-general
On 12/22/05, Carlos Moreno <moreno_pg@mochima.com> 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.

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.

But that should not crash the server, so gdb trace could be still useful.

> 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.

If you want to hack, you could try adding SHA224 to the SHA2
implementation in 8.1.  There are currently only SHA256/384/512
hashes implemented.  (AFAIR it is basically truncated SHA256
but with different init vector)

--
marko

pgsql-general by date:

Previous
From: David Fetter
Date:
Subject: Re: Sorting array field
Next
From: "Ted Byers"
Date:
Subject: Re: Stored procedure