Thread: Adding Functionality
Hello, i'm quite a newbie using postgres 7.2 so this may be an easy question, but how do i add new funtionality? I mean, i wannaadd a couple of new functions, and i've found this files, pg_proc.h and fmgrtab.c, but i don't know the meaning of thefields, so i can't add anything. For instance, in fmgrtab.c: { 61, "chareq", 2, true, false, chareq } i know 61 is like the port or id for the function, "chareq" and chareq the name, but what about the 2, the true and the false?could be that 2 is the number of arguments? And in pg_proc.h DATA(insert OID = 61 ( chareq PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100 chareq - )) what's the meaning of those f's? Thank you very much! http://webmail.wanadoo.es. Tu correo gratuito, rápido y en español
That stuff defines the pg_proc table. Generally you use the CREATE FUNCTION command to add functions. It takes care of all these details for you :) \d pg_proc might give you some info. On Wed, Feb 18, 2004 at 11:49:39AM -0500, Fernando Alonso Renault wrote: > Hello, > > i'm quite a newbie using postgres 7.2 so this may be an easy question, but how do i add new funtionality? I mean, i wannaadd a couple of new functions, and i've found this files, pg_proc.h and fmgrtab.c, but i don't know the meaning of thefields, so i can't add anything. > > For instance, in fmgrtab.c: > > { 61, "chareq", 2, true, false, chareq } > > i know 61 is like the port or id for the function, "chareq" and chareq the name, but what about the 2, the true and thefalse? could be that 2 is the number of arguments? > > And in pg_proc.h > > DATA(insert OID = 61 ( chareq PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100 chareq - )) > > what's the meaning of those f's? > > Thank you very much! > > http://webmail.wanadoo.es. Tu correo gratuito, rápido y en español > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > If the Catholic church can survive the printing press, science fiction > will certainly weather the advent of bookwarez. > http://craphound.com/ebooksneitherenorbooks.txt - Cory Doctorow
Attachment
I read about the CREATE FUNCTION command, but the problem is that i must do it the hard way (orders are orders :( ). i learntto do it like that in mysql, by using the CREATE FUNCTION and by adding the lines to the different files, but knowi must do it adding the lines. i tried downloading a couple of manuals but they didn't give me any clue, ideas? Thanks!!! ************************ That stuff defines the pg_proc table. Generally you use the CREATE FUNCTION command to add functions. It takes care of all these details for you :) \d pg_proc might give you some info. On Wed, Feb 18, 2004 at 11:49:39AM -0500, Fernando Alonso Renault wrote: > Hello, > > i'm quite a newbie using postgres 7.2 so this may be an easy question, but how do i add new funtionality? I mean, i wannaadd a couple of new functions, and i've found this files, pg_proc.h and fmgrtab.c, but i don't know the meaning of thefields, so i can't add anything. > > For instance, in fmgrtab.c: > > { 61, "chareq", 2, true, false, chareq } > > i know 61 is like the port or id for the function, "chareq" and chareq the name, but what about the 2, the true and thefalse? could be that 2 is the number of arguments? > > And in pg_proc.h > > DATA(insert OID = 61 ( chareq PGUID 12 f t t t 2 f 16 "18 18" 100 0 0 100 chareq - )) > > what's the meaning of those f's? > > Thank you very much! > > http://webmail.wanadoo.es. Tu correo gratuito, rápido y en español > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > If the Catholic church can survive the printing press, science fiction > will certainly weather the advent of bookwarez. > http://craphound.com/ebooksneitherenorbooks.txt - Cory Doctorow http://webmail.wanadoo.es. Tu correo gratuito, rápido y en español
Fernando Alonso Renault <proyectolsd@wanadoo.es> writes: > i'm quite a newbie using postgres 7.2 so this may be an easy question, but how do i add new funtionality? I mean, i wannaadd a couple of new functions, and i've found this files, pg_proc.h and fmgrtab.c, but i don't know the meaning of thefields, so i can't add anything. You probably should be thinking in terms of using CREATE FUNCTION rather than hand-hacking the initial database contents. However, pg_proc columns are documented at the top of pg_proc.h (not to mention in the System Catalogs chapter of the developer documentation), and fmgrtab.c is an automatically derived file that you shouldn't need to touch at all. There is a good deal of documentation about writing new functions in the HTML documentation, and lots of examples in the contrib/ tree. Note that none of those examples rely on changing pg_proc.h ... regards, tom lane