Re: pg_proc without oid?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_proc without oid?
Date: 2007-02-19 15:50:39
Message-ID: 10684.1171900239@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Am Montag, 19. Februar 2007 16:26 schrieb Tom Lane:
>> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>>> Am Montag, 19. Februar 2007 10:16 schrieb Magnus Hagander:
>>>> This breaks the fmgrtab generator on msvc.
>>
>>> It's intentional.
>>
>> Kindly change that intention.

> What is wrong?

Well, in the first place Gen_fmgrtab.sh is producing garbage:

#define F_CURSOR_TO_XML DATAINSERT
#define F_CURSOR_TO_XMLSCHEMA DATAINSERT
#define F_QUERY_TO_XML DATAINSERT
#define F_QUERY_TO_XML_AND_XMLSCHEMA DATAINSERT
#define F_QUERY_TO_XMLSCHEMA DATAINSERT
#define F_TABLE_TO_XML DATAINSERT
#define F_TABLE_TO_XML_AND_XMLSCHEMA DATAINSERT
#define F_TABLE_TO_XMLSCHEMA DATAINSERT
#define F_BYTEAOUT 31
#define F_CHAROUT 33

const FmgrBuiltin fmgr_builtins[] = {
{ 0, "cursor_to_xml", 5, true, false, cursor_to_xml },
{ 0, "cursor_to_xmlschema", 4, true, false, cursor_to_xmlschema },
{ 0, "query_to_xml", 4, true, false, query_to_xml },
{ 0, "query_to_xml_and_xmlschema", 4, true, false, query_to_xml_and_xmlschema },
{ 0, "query_to_xmlschema", 4, true, false, query_to_xmlschema },
{ 0, "table_to_xml", 4, true, false, table_to_xml },
{ 0, "table_to_xml_and_xmlschema", 4, true, false, table_to_xml_and_xmlschema },
{ 0, "table_to_xmlschema", 4, true, false, table_to_xmlschema },
{ 31, "byteaout", 1, true, false, byteaout },

The fact that that table is broken means you're incurring expensive
linear searches to invoke these functions. It's only by chance that
it works at all...

In the second place, if you don't want to predetermine OIDs for your
functions then they shouldn't be in hardwired pg_proc.h rows at all.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Guillaume Smet 2007-02-19 15:54:26 Re: n-gram search function
Previous Message Peter Eisentraut 2007-02-19 15:43:32 Re: Chatter on DROP SOMETHING IF EXISTS