Re: [HACKERS] Patch for user-defined C-language functions - Mailing list pgsql-hackers

From Bernard Frankpitt
Subject Re: [HACKERS] Patch for user-defined C-language functions
Date
Msg-id 37DE6E02.32E4B3AD@pop.dn.net
Whole thread Raw
In response to Re: [HACKERS] Patch for user-defined C-language functions  (Andreas Zeugswetter <andreas.zeugswetter@telecom.at>)
List pgsql-hackers
Andreas Zeugswetter wrote:
> 
> But I think the intuitive Syntax in SQL would use ():
> 
> CREATE FUNCTION mytype3 ( mytype2 )
>        RETURNS mytype3
>        AS 'mytypes.so(mytype2_to_mytype3)'
>        LANGUAGE 'C'
> 
> Syntax:
>         AS <link_file>[(symbol_name)]
> 
> This is also how Illustra and now Informix does it.
> (Instead of AS they say EXTERNAL NAME)
> 

The syntax  
AS <link_file>[(symbol_name)] 

would be easy to implement provided I could write your example as
CREATE FUNCTION mytype3 ( mytype2 )       RETURNS mytype3       AS 'mytypes.so'('mytype2_to_mytype3')       LANGUAGE
'C'

That way link_file and symbol_name both look like string tokens to 
the parser.  If it is implemented the way you write in the example with 
'mytypes.so(mytype2_to_mytype3)'

Then the parser sees the arguement of the AS clause as a single
string token which would have to be parsed separately.  Also, there is
some ambiguity in this form as to whether the string
'mytypes.so(mytype2_to_mytype3)'

is a single filename, or a filename and a link symbol

Bernie


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Status report: long-query-string changes
Next
From: Theo Kramer
Date:
Subject: Re: [HACKERS] ISO dates with European Format