Re: pg_proc without oid? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_proc without oid?
Date
Msg-id 10684.1171900239@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_proc without oid?  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: pg_proc without oid?  (Gregory Stark <stark@enterprisedb.com>)
Re: pg_proc without oid?  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Am Montag, 19. Februar 2007 16:26 schrieb Tom Lane:
>> Peter Eisentraut <peter_e@gmx.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


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Chatter on DROP SOMETHING IF EXISTS
Next
From: "Guillaume Smet"
Date:
Subject: Re: n-gram search function