Re: [SQL] MD5 sums of large objects

2007-04-09 Thread Dirk Jagdmann
Hello Michael, thanks for the comments on my corrected function. You could make a proposal in pgsql-hackers but I think 8.3 is in feature freeze so don't expect to see it until 8.4, if it's accepted at all. There's always PgFoundry :-) I'll now see how this performs in my application and if

Re: [SQL] MD5 sums of large objects

2007-04-08 Thread Michael Fuhr
On Mon, Apr 09, 2007 at 02:07:16AM +0200, Dirk Jagdmann wrote: > this works like charm. Although I did fix the argument for lo_lseek: Oops; thanks for fixing that. > INV_READ constant integer := 262144; -- 0x4 from libpq-fs.h You could also use a hex constant (the cast to integer is necess

Re: [SQL] MD5 sums of large objects

2007-04-08 Thread Dirk Jagdmann
Hello Michael, this works like charm. Although I did fix the argument for lo_lseek: CREATE OR REPLACE FUNCTION md5(id oid) RETURNS text as $$ DECLARE fdinteger; size integer; hashval text; INV_READ constant integer := 262144; -- 0x4 from libpq-fs.h SEEK_SET constant int

Re: [SQL] MD5 sums of large objects

2007-04-08 Thread Michael Fuhr
On Sun, Apr 08, 2007 at 07:03:17PM +0200, Dirk Jagdmann wrote: > I have a database containing lots of large objects. Now I'd like to > compare large objects in my database and I thought of having a > function which creates a hashsum (MD5, SHA-1 or whatever) of my large > object, so I can use that i

[SQL] MD5 sums of large objects

2007-04-08 Thread Dirk Jagdmann
Hello all together, I have a database containing lots of large objects. Now I'd like to compare large objects in my database and I thought of having a function which creates a hashsum (MD5, SHA-1 or whatever) of my large object, so I can use that in queries: create function lo_md5(id oid) return