postgresql/src/tools/backend
Bruce Momjian 9394d62c73 I have been working with user defined types and user defined c
functions.  One problem that I have encountered with the function
manager is that it does not allow the user to define type conversion
functions that convert between user types. For instance if mytype1,
mytype2, and mytype3 are three Postgresql user types, and if I wish to
define Postgresql conversion functions like

I run into problems, because the Postgresql dynamic loader would look
for a single link symbol, mytype3, for both pieces of object code.  If
I just change the name of one of the Postgresql functions (to make the
symbols distinct), the automatic type conversion that Postgresql uses,
for example, when matching operators to arguments no longer finds the
type conversion function.

The solution that I propose, and have implemented in the attatched
patch extends the CREATE FUNCTION syntax as follows. In the first case
above I use the link symbol mytype2_to_mytype3 for the link object
that implements the first conversion function, and define the
Postgresql operator with the following syntax

The patch includes changes to the parser to include the altered
syntax, changes to the ProcedureStmt node in nodes/parsenodes.h,
changes to commands/define.c to handle the extra information in the AS
clause, and changes to utils/fmgr/dfmgr.c that alter the way that the
dynamic loader figures out what link symbol to use.  I store the
string for the link symbol in the prosrc text attribute of the pg_proc
table which is currently unused in rows that reference dynamically
loaded
functions.


Bernie Frankpitt
1999-09-28 04:34:56 +00:00
..
README New backend_dir html source. 1997-10-29 23:48:18 +00:00
backend_dirs.html Update backend flowchart. 1998-06-28 06:17:14 +00:00
flow.fig Reverse out last scan.l patch for minus handling.\ 1999-09-28 03:41:40 +00:00
flow.gif Reverse out last scan.l patch for minus handling.\ 1999-09-28 03:41:40 +00:00
index.html I have been working with user defined types and user defined c 1999-09-28 04:34:56 +00:00

README

Just point your browser at the index.html file, and click on the 
flowchart to see the description and source code.