Re: [HACKERS] Doc updates

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] Doc updates
Дата
Msg-id 200004082142.RAA19080@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Doc updates  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] Doc updates  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-docs
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > OK, can someone confirm which items still need to be done to update the
> > documentation?
>
> > Remove ':' and ';' operators
>
> They're not actually removed yet, just deprecated, so if you have
> "removed" in the history file please change it.  Otherwise, the
> docs are updated.

Deprecated.  Sorry. Never updated this list.

> > Improve CREATE FUNCTION to allow type conversion specification
> >         (Bernie Frankpitt)
>
> Huh?  I'm not sure what that is.

OK.  Here is the info.  Not sure if it is in the man page or not.
Attached is the CVS log, and the actual diff of gram.y for that patch.

Seems the major change is:

!                        RETURNS func_return opt_with AS Sconst LANGUAGE Sconst

!                        RETURNS func_return opt_with AS func_as LANGUAGE Sconst
                                                         ^^^^^^^

--
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

RCS file: /usr/local/cvsroot/pgsql/src/backend/parser/gram.y,v
Working file: gram.y
head: 2.167
branch:
locks: strict
access list:
symbolic names:
    REL6_5_PATCHES: 2.88.0.2
    REL6_5: 2.88
    REL6_4: 2.37.0.2
    release-6-3: 2.5
    REL2_0B: 1.20.0.2
    REL2_0: 1.20
    Release_2_0_0: 1.7
    Release_1_0_3: 1.2.0.2
    Release_2_0: 1.6
    Release_1_0_2: 1.2
    PG95-1_01: 1.1.1.1
    PG95_DIST: 1.1.1
keyword substitution: kv
total revisions: 283;    selected revisions: 1
description:
----------------------------
revision 2.100
date: 1999/09/28 04:34:44;  author: momjian;  state: Exp;  lines: +9 -3
   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
=============================================================================
Index: gram.y
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.99
retrieving revision 2.100
diff -c -r2.99 -r2.100
*** gram.y    1999/09/23 17:02:46    2.99
--- gram.y    1999/09/28 04:34:44    2.100
***************
*** 10,16 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /usr/local/cvsroot/pgsql/src/backend/parser/gram.y,v 2.99 1999/09/23 17:02:46 momjian Exp $
   *
   * HISTORY
   *      AUTHOR            DATE            MAJOR EVENT
--- 10,16 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /usr/local/cvsroot/pgsql/src/backend/parser/gram.y,v 2.100 1999/09/28 04:34:44 momjian Exp $
   *
   * HISTORY
   *      AUTHOR            DATE            MAJOR EVENT
***************
*** 163,169 ****
  %type <list>    stmtblock, stmtmulti,
          result, relation_name_list, OptTableElementList,
          OptInherit, definition,
!         opt_with, func_args, func_args_list,
          oper_argtypes, RuleActionList, RuleActionBlock, RuleActionMulti,
          opt_column_list, columnList, opt_va_list, va_list,
          sort_clause, sortby_list, index_params, index_list, name_list,
--- 163,169 ----
  %type <list>    stmtblock, stmtmulti,
          result, relation_name_list, OptTableElementList,
          OptInherit, definition,
!         opt_with, func_args, func_args_list, func_as,
          oper_argtypes, RuleActionList, RuleActionBlock, RuleActionMulti,
          opt_column_list, columnList, opt_va_list, va_list,
          sort_clause, sortby_list, index_params, index_list, name_list,
***************
*** 1923,1929 ****
   *****************************************************************************/

  ProcedureStmt:    CREATE FUNCTION func_name func_args
!              RETURNS func_return opt_with AS Sconst LANGUAGE Sconst
                  {
                      ProcedureStmt *n = makeNode(ProcedureStmt);
                      n->funcname = $3;
--- 1923,1929 ----
   *****************************************************************************/

  ProcedureStmt:    CREATE FUNCTION func_name func_args
!              RETURNS func_return opt_with AS func_as LANGUAGE Sconst
                  {
                      ProcedureStmt *n = makeNode(ProcedureStmt);
                      n->funcname = $3;
***************
*** 1947,1952 ****
--- 1947,1958 ----
                  {    $$ = lcons(makeString($1),NIL); }
          | func_args_list ',' TypeId
                  {    $$ = lappend($1,makeString($3)); }
+         ;
+
+ func_as: Sconst
+                 {   $$ = lcons(makeString($1),NIL); }
+         | Sconst ',' Sconst
+                 {     $$ = lappend(lcons(makeString($1),NIL), makeString($3)); }
          ;

  func_return:  set_opt TypeId

В списке pgsql-docs по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Doc updates - pg_options
Следующее
От: Bruce Momjian
Дата:
Сообщение: Open documentation items for 7.0