Re: UDFs - Mailing list pgsql-general

From jf
Subject Re: UDFs
Date
Msg-id Pine.LNX.4.64.0708131908360.4503@localhost.localdomain
Whole thread Raw
In response to Re: UDFs  (hubert depesz lubaczewski <depesz@depesz.com>)
Responses Re: UDFs
List pgsql-general
>
> your function is also not compiled on default. but pgcrypto is at the
> very least available by default (in sources, or in precompiled
> packages).

Yes I understand, and trust me I'm typically not a 'not made in my house'
type, but google for pgcrypto, you don't find much out there other than
'look in contrib/', and honestly I wasn't about to sit down and recompile
everything to get a bunch of functionality I really didn't need, I (in
hindsight incorrectly) decided it would be quicker just to write a UDF.

Where the incorrectly part is that I've been battling for a couple hours
trying to figure out why even though I had changed the UDF to use BYTEA
primitives instead of TEXT it was still using TEXTs, and I just learned
something new, CREATE OR REPLACE FUNCTION [...] doesn't replace the
function if you change the types; it makes sense, I've just trying to
figure out wth is going on.

> i dont know about online documentation, but in installed pgcrypto you
> have a nice readme with all functions described.

Expecting people who may or may not have the source sitting around anymore
to download the source to look at the documentation to even determine if
they want to use that code is not a very effective method of marketing,
imho of course.

This holds especially true when the online manual for the
DB itself is lacking in many places (ie can palloc() fail? does palloc0()
zero out the memory returned? et cetera), I had to dig through the header
files just to find the various types and such, and then its still not
entirely clear what exactly the header for the variable length types is,
in one header file it gets typedef'd to a structure defined right above it
that contains a length field and an array of a single character (does that
serve as a pointer to the beginning of the data?), but then the
VARDATA()/VARSIZE()/et cetera macro's appear to work on an entirely
different structure, but there is no immediate correlation between the two
structures in the headers.

It's a bit sad because the documentation for pgcrypto is actually quite a
bit better than for the UDFs, and it wasn't until after I had made the
decision that the UDFs would be easier and fought with it for some time
that I realized this.


> i'm not opposing to the idea. i was just checking if you do know about
> it :)

understood, I appreciate the suggestion. In addition I couldn't find any
documentation that told me how to install the functions in pgcrypto (do I
need to CREATE FUNCTION for every function in there?), the README mentions
a .sql file thats supposed to get you up and going, but the only .sql file
I found in the directory was an uninstall .sql file, am I expected to grok
it and do the inverse for every step? et cetera.

I don't mean to come off as a complainer, but the documentation for the DB
overall seems to be lacking, and that was my main reason for opting out,
even if now that all is said and done it would've been easier to use
pgcrypto.

 > best regards,
>
> depesz


cheers,

jf

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: UDFs
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: UDFs