mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Attached patch for unconditional enabling of pltcl-unknown support.
Enabling this feature adds very light overhead of 1 select from pg_class on first using of pl/tcl in backend if unknown suppport is really unused. But pl/tcl with this support has very improved functionality. Patch includes changes to documentation.
This commit is contained in:
parent
36458b93e0
commit
1d3a47af0c
16
configure.in
16
configure.in
@ -382,22 +382,6 @@ PGAC_ARG_REQ(with, tclconfig, [ --with-tclconfig=DIR tclConfig.sh and tkConf
|
|||||||
|
|
||||||
PGAC_ARG_REQ(with, tkconfig, [ --with-tkconfig=DIR tkConfig.sh is in DIR])
|
PGAC_ARG_REQ(with, tkconfig, [ --with-tkconfig=DIR tkConfig.sh is in DIR])
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# If Tcl is enabled (above) then check for pltcl_unknown_support
|
|
||||||
#
|
|
||||||
AC_MSG_CHECKING([whether to build with PL/Tcl unknown support])
|
|
||||||
if test "$with_tcl" = yes; then
|
|
||||||
PGAC_ARG_BOOL(enable, pltcl-unknown, no,
|
|
||||||
[ --enable-pltcl-unknown build PL/Tcl unknown support (if Tcl is enabled)],
|
|
||||||
[AC_DEFINE([ENABLE_PLTCL_UNKNOWN])])
|
|
||||||
else
|
|
||||||
enable_pltcl_unknown=no
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT([$enable_pltcl_unknown])
|
|
||||||
AC_SUBST([enable_pltcl_unknown])
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Optionally build Perl modules (Pg.pm and PL/Perl)
|
# Optionally build Perl modules (Pg.pm and PL/Perl)
|
||||||
#
|
#
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.61 2001/10/09 22:32:32 petere Exp $ -->
|
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.62 2001/10/13 04:23:50 momjian Exp $ -->
|
||||||
|
|
||||||
<chapter id="installation">
|
<chapter id="installation">
|
||||||
<title><![%standalone-include[<productname>PostgreSQL</>]]>
|
<title><![%standalone-include[<productname>PostgreSQL</>]]>
|
||||||
@ -683,15 +683,6 @@ su - postgres
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><option>--enable-pltcl-unknown</option></term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
Enables enables PL/Tcl unknown support.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--enable-odbc</option></term>
|
<term><option>--enable-odbc</option></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.14 2001/09/13 15:55:23 petere Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.15 2001/10/13 04:23:50 momjian Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="pltcl">
|
<chapter id="pltcl">
|
||||||
@ -513,11 +513,13 @@ CREATE FUNCTION t1_count(int4, int4) RETURNS int4 AS '
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
</variablelist>
|
||||||
Modules and the <function>unknown</> command
|
|
||||||
</term>
|
</sect2>
|
||||||
<listitem>
|
|
||||||
|
<sect2>
|
||||||
|
<title> Modules and the <function>unknown</> command</title>
|
||||||
<para>
|
<para>
|
||||||
PL/Tcl has a special support for things often used. It
|
PL/Tcl has a special support for things often used. It
|
||||||
recognizes two magic tables, <literal>pltcl_modules</> and
|
recognizes two magic tables, <literal>pltcl_modules</> and
|
||||||
@ -526,20 +528,15 @@ CREATE FUNCTION t1_count(int4, int4) RETURNS int4 AS '
|
|||||||
creation. Whenever an unknown Tcl procedure is called, the
|
creation. Whenever an unknown Tcl procedure is called, the
|
||||||
unknown proc is asked to check if the procedure is defined in
|
unknown proc is asked to check if the procedure is defined in
|
||||||
one of the modules. If this is true, the module is loaded on
|
one of the modules. If this is true, the module is loaded on
|
||||||
demand. To enable this behavior, the
|
demand.
|
||||||
<productname>PostgreSQL</> must be configured with the option
|
|
||||||
<option>--enable-pltcl-unknown</option>.
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
There are support scripts to maintain these tables in the modules
|
There are support scripts to maintain these tables:
|
||||||
subdirectory of the PL/Tcl source including the source for the
|
<command>pltcl_loadmod</>,<command>pltcl_listmod</>,
|
||||||
unknown module that must get installed initially.
|
<command>pltcl_delmod</> and source for the
|
||||||
|
unknown module <filename>share/unknown.pltcl</> that must be loaded
|
||||||
|
into database initially for getting unknown support.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* or in pg_config.h afterwards. Of course, if you edit pg_config.h, then your
|
* or in pg_config.h afterwards. Of course, if you edit pg_config.h, then your
|
||||||
* changes will be overwritten the next time you run configure.
|
* changes will be overwritten the next time you run configure.
|
||||||
*
|
*
|
||||||
* $Id: pg_config.h.in,v 1.8 2001/10/01 15:33:31 momjian Exp $
|
* $Id: pg_config.h.in,v 1.9 2001/10/13 04:23:50 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PG_CONFIG_H
|
#ifndef PG_CONFIG_H
|
||||||
@ -86,9 +86,6 @@
|
|||||||
*/
|
*/
|
||||||
#undef DEF_MAXBACKENDS
|
#undef DEF_MAXBACKENDS
|
||||||
|
|
||||||
/* --enable-pltcl-unknown */
|
|
||||||
#undef ENABLE_PLTCL_UNKNOWN
|
|
||||||
|
|
||||||
/* --enable-nls */
|
/* --enable-nls */
|
||||||
#undef ENABLE_NLS
|
#undef ENABLE_NLS
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Makefile for the pltcl shared object
|
# Makefile for the pltcl shared object
|
||||||
#
|
#
|
||||||
# $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.34 2001/09/16 16:11:11 petere Exp $
|
# $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.35 2001/10/13 04:23:50 momjian Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -86,29 +86,21 @@ endif
|
|||||||
ifeq ($(TCL_SHARED_BUILD), 1)
|
ifeq ($(TCL_SHARED_BUILD), 1)
|
||||||
|
|
||||||
all: $(INFILES)
|
all: $(INFILES)
|
||||||
ifeq ($(enable_pltcl_unknown), yes)
|
|
||||||
$(MAKE) -C modules $@
|
$(MAKE) -C modules $@
|
||||||
endif
|
|
||||||
|
|
||||||
pltcl$(DLSUFFIX): pltcl.o
|
pltcl$(DLSUFFIX): pltcl.o
|
||||||
|
|
||||||
install: all installdirs
|
install: all installdirs
|
||||||
$(INSTALL_SHLIB) $(DLOBJS) $(DESTDIR)$(pkglibdir)/$(DLOBJS)
|
$(INSTALL_SHLIB) $(DLOBJS) $(DESTDIR)$(pkglibdir)/$(DLOBJS)
|
||||||
ifeq ($(enable_pltcl_unknown), yes)
|
|
||||||
$(MAKE) -C modules $@
|
$(MAKE) -C modules $@
|
||||||
endif
|
|
||||||
|
|
||||||
installdirs:
|
installdirs:
|
||||||
$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
|
$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
|
||||||
ifeq ($(enable_pltcl_unknown), yes)
|
|
||||||
$(MAKE) -C modules $@
|
$(MAKE) -C modules $@
|
||||||
endif
|
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(pkglibdir)/$(DLOBJS)
|
rm -f $(DESTDIR)$(pkglibdir)/$(DLOBJS)
|
||||||
ifeq ($(enable_pltcl_unknown), yes)
|
|
||||||
$(MAKE) -C modules $@
|
$(MAKE) -C modules $@
|
||||||
endif
|
|
||||||
|
|
||||||
else # TCL_SHARED_BUILD = 0
|
else # TCL_SHARED_BUILD = 0
|
||||||
|
|
||||||
@ -124,6 +116,4 @@ Makefile.tcldefs: mkMakefile.tcldefs.sh
|
|||||||
|
|
||||||
clean distclean maintainer-clean:
|
clean distclean maintainer-clean:
|
||||||
rm -f $(INFILES) pltcl.o Makefile.tcldefs
|
rm -f $(INFILES) pltcl.o Makefile.tcldefs
|
||||||
ifeq ($(enable_pltcl_unknown), yes)
|
|
||||||
$(MAKE) -C modules $@
|
$(MAKE) -C modules $@
|
||||||
endif
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.43 2001/10/06 23:21:45 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.44 2001/10/13 04:23:50 momjian Exp $
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
@ -146,9 +146,7 @@ static FunctionCallInfo pltcl_current_fcinfo = NULL;
|
|||||||
static void pltcl_init_all(void);
|
static void pltcl_init_all(void);
|
||||||
static void pltcl_init_interp(Tcl_Interp *interp);
|
static void pltcl_init_interp(Tcl_Interp *interp);
|
||||||
|
|
||||||
#ifdef ENABLE_PLTCL_UNKNOWN
|
|
||||||
static void pltcl_init_load_unknown(Tcl_Interp *interp);
|
static void pltcl_init_load_unknown(Tcl_Interp *interp);
|
||||||
#endif
|
|
||||||
|
|
||||||
Datum pltcl_call_handler(PG_FUNCTION_ARGS);
|
Datum pltcl_call_handler(PG_FUNCTION_ARGS);
|
||||||
Datum pltclu_call_handler(PG_FUNCTION_ARGS);
|
Datum pltclu_call_handler(PG_FUNCTION_ARGS);
|
||||||
@ -293,7 +291,6 @@ pltcl_init_interp(Tcl_Interp *interp)
|
|||||||
Tcl_CreateCommand(interp, "spi_lastoid",
|
Tcl_CreateCommand(interp, "spi_lastoid",
|
||||||
pltcl_SPI_lastoid, NULL, NULL);
|
pltcl_SPI_lastoid, NULL, NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_PLTCL_UNKNOWN
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* Try to load the unknown procedure from pltcl_modules
|
* Try to load the unknown procedure from pltcl_modules
|
||||||
************************************************************/
|
************************************************************/
|
||||||
@ -302,12 +299,9 @@ pltcl_init_interp(Tcl_Interp *interp)
|
|||||||
pltcl_init_load_unknown(interp);
|
pltcl_init_load_unknown(interp);
|
||||||
if (SPI_finish() != SPI_OK_FINISH)
|
if (SPI_finish() != SPI_OK_FINISH)
|
||||||
elog(ERROR, "pltcl_init_interp(): SPI_finish failed");
|
elog(ERROR, "pltcl_init_interp(): SPI_finish failed");
|
||||||
#endif /* ENABLE_PLTCL_UNKNOWN */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_PLTCL_UNKNOWN
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* pltcl_init_load_unknown() - Load the unknown procedure from
|
* pltcl_init_load_unknown() - Load the unknown procedure from
|
||||||
* table pltcl_modules (if it exists)
|
* table pltcl_modules (if it exists)
|
||||||
@ -380,8 +374,6 @@ pltcl_init_load_unknown(Tcl_Interp *interp)
|
|||||||
Tcl_DStringFree(&unknown_src);
|
Tcl_DStringFree(&unknown_src);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ENABLE_PLTCL_UNKNOWN */
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* pltcl_call_handler - This is the only visible function
|
* pltcl_call_handler - This is the only visible function
|
||||||
|
Loading…
x
Reference in New Issue
Block a user