Search Postgresql Archives

Why is create function bringing down the Backend server?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I'm trying to add additional functionality to the contrib/pgcrypto
branch  (at least for my own use, although ideally, I'd like to
make whatever additions good enough as to be accepted as part of
the PG distribution)

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

Anyway, I started with an implementation of SHA-1 that I already
have (since it is easy to test/debug, as I only have to compare it
with the already-existing sha1 function in pgcrypto).

I got it to work nicely, and I tried several millions randomly-
generated strings, and the result of my hash function matches
the result of pgcrypto's sha1 function.

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

I know the list of possible causes may be nearly infinite, so
I put the modified file (I removed most of the other stuff from
the original pgcrypto.c file, and left the pg_digest function,
which is the one that computes hashes, and the one that I
used as a model to create mine):

http://www.mochima.com/tmp/pgcrypto.c

I also modified the SQL script file to include my function;
this (when I execute this script) is precisely the moment at
which the PG backend crashes  (well, it shuts down anyway):

http://www.mochima.com/tmp/pgcrypto.sql

Any ideas of what I'm doing wrong?

BTW, I compiled with the provided Makefile, then copy the .so
files to /usr/local/pgsql/lib directory, and ran /sbin/ldconfig
(that directory is included in my /etc/ld.so.conf file).  I'm
running PG 7.4.9 on a Linux FC4 on a Dual-Core Athlon64 (kernel
x86_64-smp).

Thanks for any comments/feedback!  (please by kind, as this is
my first attempt ever at creating PG functions -- but please
be tough!  Don't hold back valuable feedback just because you
don't want to hurt my baby feelings!  :-))

Carlos
--



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux