aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/psqlHelp.h
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-09-28 04:34:56 +0000
committerBruce Momjian <bruce@momjian.us>1999-09-28 04:34:56 +0000
commit9394d62c73e35329d886f96b6b000080b20132f3 (patch)
treef410842b474e1ffff7cea0f89d442e8172c5c36c /src/bin/psql/psqlHelp.h
parent63a85082e32a64e2da0f3dde4e4426d016fb749e (diff)
downloadpostgresql-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/bin/psql/psqlHelp.h')
-rw-r--r--src/bin/psql/psqlHelp.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/bin/psql/psqlHelp.h b/src/bin/psql/psqlHelp.h
index 020d8e450e1..63268c2cbd9 100644
--- a/src/bin/psql/psqlHelp.h
+++ b/src/bin/psql/psqlHelp.h
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: psqlHelp.h,v 1.75 1999/09/27 20:27:20 momjian Exp $
+ * $Id: psqlHelp.h,v 1.76 1999/09/28 04:34:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -88,8 +88,14 @@ static struct _helpStruct QL_HELP[] = {
"create a user-defined function",
"\
\tCREATE FUNCTION function_name ([type1, ...typeN]) RETURNS return_type\n\
-\tAS 'object_filename'|'sql-queries'|'builtin_function_name'\n\
-\tLANGUAGE 'c'|'sql'|'internal';"},
+\tAS 'sql-queries'|'builtin_function_name'|'object_filename'\n\
+\tLANGUAGE 'sql'|'internal'|'c';\n\
+\n\
+OR\n\
+\n\
+\tCREATE FUNCTION function_name ([type1, ...typeN]) RETURNS return_type\n\
+\tAS 'object_filename', 'link_symbol'\n\
+\tLANGUAGE 'c';"},
{"create index",
"construct an index",
"\