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 wanna add 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 the fields, 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
From pgsql-general-owner@postgresql.org Wed Feb 18 12:59:08 2004
X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org
Received: from localhost (unknown [200.46.204.2])
by svr1.postgresql.org (Postfix) with ESMTP id 797BBD1B456
for <pgsql-general-postgresql.org@localhost.postgresql.org>; Wed, 18 Feb 2004 16:58:57 +0000 (GMT)
Received: from svr1.postgresql.org ([200.46.204.71])
by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024)
with ESMTP id 01167-01
for <pgsql-general-postgresql.org@localhost.postgresql.org>;
Wed, 18 Feb 2004 12:58:51 -0400 (AST)
Received: from gw.tssi.com (gw.tssi.com [198.147.197.1])
by svr1.postgresql.org (Postfix) with ESMTP id A0E69D1E0D2
for <pgsql-general@postgresql.org>; Wed, 18 Feb 2004 12:58:50 -0400 (AST)
Received: from gw.tssi.com (nolan@gw.tssi.com [127.0.0.1] (may be forged))
by gw.tssi.com (8.12.6/8.12.6) with ESMTP id i1IGwk8S013950;
Wed, 18 Feb 2004 10:58:47 -0600
Received: (from nolan@localhost)
by gw.tssi.com (8.12.6/8.12.6/Submit) id i1IGwk2w013948;
Wed, 18 Feb 2004 10:58:46 -0600
From: Mike Nolan <nolan@gw.tssi.com>
Message-Id: <200402181658.i1IGwk2w013948@gw.tssi.com>
Subject: Re: Differences between postgres and mysql
To: tgl@sss.pgh.pa.us (Tom Lane)
Date: Wed, 18 Feb 2004 10:58:45 -0600 (CST)
Cc: mark.cubitt@applegate.co.uk, pgsql-general@postgresql.org
In-Reply-To: <24159.1077122316@sss.pgh.pa.us> from "Tom Lane" at Feb 18, 2004 11:38:36 AM
X-Mailer: ELM [version 2.5 PL3]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: by amavisd-new at postgresql.org
X-Archive-Number: 200402/843
X-Sequence-Number: 57554
Interesting you should say that, because for years we were getting beat
up regularly about how poor our ALTER capabilities were compared to
MySQL's. Have we really passed them up in ALTER flexibility? Or is
there some other limitation you are thinking of?
I wasn't commenting on the flexibility issue, more on performance.
If you add or delete a column doesn't MySQL copy the table to a temp
table then delete the original one and rename the copy?
Try doing that on a table with 25 million rows and you can go to dinner
and a movie while you wait for it to finish. Try it on a really big
table and you can go to a performance of the Ring Cycle while you're
waiting. (And I mean the Wagner Ring, not Tolkien.)
I didn't comment on the interactive user interfaces. While there are a
few things about psql that drive me nuts (like the fact that it always does
the edit to a temporary file so it goes away immediately upon exit and
some of the ways \o works, I'm used to using both features in Oracle
to provide a historical trail of my work), mysql can't even repeat a
command (\g) without first re-editing it.
--
Mike Nolan
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 wanna add 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 the fields, 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
---------------------------(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/
Show quoted text
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
I read about the CREATE FUNCTION command, but the problem is that i must do it the hard way (orders are orders :( ). i learnt to do it like that in mysql, by using the CREATE FUNCTION and by adding the lines to the different files, but know i 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 wanna add 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 the fields, 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
---------------------------(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
From pgsql-general-owner@postgresql.org Wed Feb 18 14:16:11 2004
X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org
Received: from localhost (unknown [200.46.204.2])
by svr1.postgresql.org (Postfix) with ESMTP id 75F3BD1E133
for <pgsql-general-postgresql.org@localhost.postgresql.org>; Wed, 18 Feb 2004 18:16:10 +0000 (GMT)
Received: from svr1.postgresql.org ([200.46.204.71])
by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024)
with ESMTP id 18294-10
for <pgsql-general-postgresql.org@localhost.postgresql.org>;
Wed, 18 Feb 2004 14:16:04 -0400 (AST)
Received: from sss.pgh.pa.us (unknown [192.204.191.242])
by svr1.postgresql.org (Postfix) with ESMTP id 3A155D1E12C
for <pgsql-general@postgresql.org>; Wed, 18 Feb 2004 14:16:03 -0400 (AST)
Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1])
by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i1IIG2fB024707;
Wed, 18 Feb 2004 13:16:03 -0500 (EST)
To: Fernando Alonso Renault <proyectolsd@wanadoo.es>
Cc: "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
Subject: Re: Adding Functionality
In-reply-to: <20040218164939.4D731183E0@smtp.latinmail.com>
References: <20040218164939.4D731183E0@smtp.latinmail.com>
Comments: In-reply-to Fernando Alonso Renault <proyectolsd@wanadoo.es>
message dated "Wed, 18 Feb 2004 11:49:39 -0500"
Date: Wed, 18 Feb 2004 13:16:02 -0500
Message-ID: <24706.1077128162@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
X-Virus-Scanned: by amavisd-new at postgresql.org
X-Archive-Number: 200402/847
X-Sequence-Number: 57558
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 wanna add 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 the fields, 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
Import Notes
Resolved by subject fallback