diff options
author | Bruce Momjian <bruce@momjian.us> | 1999-09-28 04:34:56 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1999-09-28 04:34:56 +0000 |
commit | 9394d62c73e35329d886f96b6b000080b20132f3 (patch) | |
tree | f410842b474e1ffff7cea0f89d442e8172c5c36c /src/include/nodes/parsenodes.h | |
parent | 63a85082e32a64e2da0f3dde4e4426d016fb749e (diff) | |
download | postgresql-9394d62c73e35329d886f96b6b000080b20132f3.tar.gz postgresql-9394d62c73e35329d886f96b6b000080b20132f3.zip |
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
Diffstat (limited to 'src/include/nodes/parsenodes.h')
-rw-r--r-- | src/include/nodes/parsenodes.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 66c5a9132aa..4bf879137ac 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: parsenodes.h,v 1.79 1999/09/23 17:03:22 momjian Exp $ + * $Id: parsenodes.h,v 1.80 1999/09/28 04:34:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -70,7 +70,7 @@ typedef struct Query /* internal to planner */ List *base_rel_list; /* list of base-relation RelOptInfos */ List *join_rel_list; /* list of join-relation RelOptInfos */ - List *query_pathkeys; /* pathkeys for query_planner()'s result */ + List *query_pathkeys; /* pathkeys for query_planner()'s result */ } Query; @@ -361,7 +361,7 @@ typedef struct ProcedureStmt Node *returnType; /* the return type (as a string or a * TypeName (ie.setof) */ List *withClause; /* a list of ParamString */ - char *as; /* the SQL statement or filename */ + List *as; /* the SQL statement or filename */ char *language; /* C or SQL */ } ProcedureStmt; @@ -836,8 +836,10 @@ typedef struct ResTarget { NodeTag type; char *name; /* column name or NULL */ - List *indirection; /* subscripts for destination column, or NIL */ - Node *val; /* the value expression to compute or assign */ + List *indirection; /* subscripts for destination column, or + * NIL */ + Node *val; /* the value expression to compute or + * assign */ } ResTarget; /* @@ -970,7 +972,7 @@ typedef struct RangeTblEntry typedef struct SortClause { NodeTag type; - Index tleSortGroupRef; /* reference into targetlist */ + Index tleSortGroupRef;/* reference into targetlist */ Oid sortop; /* the sort operator to use */ } SortClause; |