Creating function and aggregate - problem
Creating function and aggregate - problem
От:
"Oliver Elphick" <olly@lfix.co.uk>
Дата:
I have tried to create a min(oid) aggregate, but when I use it, I get
the message `ERROR: fmgr_info: function 108994: cache lookup failed'.
What does this mean, please?
I created it thus:
create function oid4smaller (oid, oid) returns oid as
'/home/olly/cprogs/oidcompare.so' language 'c';
create aggregate min (basetype = oid, sfunc1 = oid4smaller,
stype1 = oid, stype2 = oid);
The C file is compiled and linked thus (for Linux x86):
$ gcc -o oidcompare.o -c -I/usr/include/postgresql oidcompare.c
$ gcc -shared -o oidcompare.so oidcompare.o
and it says:
#include
Oid oid4smaller(Oid o1, Oid o2) {
return (o1 < o2 ? o1 : o2);
}
Oid oid4larger(Oid o1, Oid o2) {
return (o1 > o2 ? o1 : o2);
}
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"The LORD is nigh unto all them that call upon him, to
all that call upon him in truth."
Psalms 145:18
Simple question....
От:
Summer <summerd@cs.unm.edu>
Дата:
... I hope I have a table with a couple of varchar columns that needs to have all it values all capitalized. SO this : id|last_name|first_m |login_id|sex ----+---------+---------+--------+--- 1231|Reid |Samuel R.|sreid |M would become : id|last_name|first_m |login_id|sex ----+---------+---------+--------+--- 1231|REID |SAMUEL R.|sreid |M This way when I bring them up alphabetically - it will be correct. I remember seeing this on the list a couple of months ago but I cannot remember the fix... Thanks for any advice Summer
Re: [GENERAL] Simple question....
От:
Matthew Hixson <hixson@frozenwave.com>
Дата:
On Mon, 23 Nov 1998, Summer wrote: > I have a table with a couple of varchar columns that needs to have all it > values all capitalized. > > SO this : > > id|last_name|first_m |login_id|sex > ----+---------+---------+--------+--- > 1231|Reid |Samuel R.|sreid |M > > would become : > > id|last_name|first_m |login_id|sex > ----+---------+---------+--------+--- > 1231|REID |SAMUEL R.|sreid |M > > This way when I bring them up alphabetically - it will be correct. > I remember seeing this on the list a couple of months ago but I cannot > remember the fix... I think what you want is something like this: select *,upper(last_name) as last,upper(first_m) as first from