Remove the default_do_language parameter, instead making DO use a hardwired

default of "plpgsql".  This is more reasonable than it was when the DO patch
was written, because we have since decided that plpgsql should be installed
by default.  Per discussion, having a parameter for this doesn't seem useful
enough to justify the risk of application breakage if the value is changed
unexpectedly.
This commit is contained in:
Tom Lane 2010-01-26 16:33:40 +00:00
parent 6c0f94fc0d
commit d879697cd2
8 changed files with 13 additions and 44 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.245 2010/01/23 16:37:12 sriggs Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.246 2010/01/26 16:33:40 tgl Exp $ -->
<chapter Id="runtime-config">
<title>Server Configuration</title>
@ -4132,21 +4132,6 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
</listitem>
</varlistentry>
<varlistentry id="guc-default-do-language" xreflabel="default_do_language">
<term><varname>default_do_language</varname> (<type>string</type>)</term>
<indexterm>
<primary><varname>default_do_language</> configuration parameter</primary>
</indexterm>
<listitem>
<para>
This parameter specifies the language to use when the
<literal>LANGUAGE</> option is omitted in a
<xref linkend="sql-do" endterm="sql-do-title"> statement.
The default is <literal>plpgsql</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-default-transaction-isolation" xreflabel="default_transaction_isolation">
<indexterm>
<primary>transaction isolation level</primary>

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/do.sgml,v 1.2 2009/09/23 15:41:51 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/do.sgml,v 1.3 2010/01/26 16:33:40 tgl Exp $
PostgreSQL documentation
-->
@ -69,8 +69,7 @@ DO <replaceable class="PARAMETER">code</replaceable> [ LANGUAGE <replaceable cla
<listitem>
<para>
The name of the procedural language the code is written in.
If omitted, the default is determined by the runtime parameter
<xref linkend="guc-default-do-language">.
If omitted, the default is <literal>plpgsql</>.
</para>
</listitem>
</varlistentry>
@ -83,6 +82,7 @@ DO <replaceable class="PARAMETER">code</replaceable> [ LANGUAGE <replaceable cla
<para>
The procedural language to be used must already have been installed
into the current database by means of <command>CREATE LANGUAGE</>.
<literal>plpgsql</> is installed by default, but other languages are not.
</para>
<para>
@ -108,8 +108,6 @@ BEGIN
END LOOP;
END$$;
</programlisting>
This example assumes that <varname>default_do_language</> has its
default value, namely <literal>plpgsql</>.
</para>
</refsect1>
<refsect1>

View File

@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.114 2010/01/02 16:57:37 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.115 2010/01/26 16:33:40 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@ -2001,11 +2001,11 @@ ExecuteDoStmt(DoStmt *stmt)
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("no inline code specified")));
/* if LANGUAGE option wasn't specified, use the default language */
/* if LANGUAGE option wasn't specified, use the default */
if (language_item)
language = strVal(language_item->arg);
else
language = default_do_language;
language = "plpgsql";
/* Convert language name to canonical case */
languageName = case_translate_language_name(language);

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.535 2010/01/24 21:49:17 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.536 2010/01/26 16:33:40 tgl Exp $
*
*--------------------------------------------------------------------
*/
@ -383,8 +383,6 @@ char *external_pid_file;
char *pgstat_temp_directory;
char *default_do_language;
char *application_name;
int tcp_keepalives_idle;
@ -2603,15 +2601,6 @@ static struct config_string ConfigureNamesString[] =
},
#endif /* USE_SSL */
{
{"default_do_language", PGC_USERSET, CLIENT_CONN_STATEMENT,
gettext_noop("Sets the language used in DO statement if LANGUAGE is not specified."),
NULL
},
&default_do_language,
"plpgsql", NULL, NULL
},
{
{"application_name", PGC_USERSET, LOGGING,
gettext_noop("Sets the application name to be reported in statistics and logs."),

View File

@ -432,7 +432,6 @@
#temp_tablespaces = '' # a list of tablespace names, '' uses
# only default tablespace
#check_function_bodies = on
#default_do_language = 'plpgsql'
#default_transaction_isolation = 'read committed'
#default_transaction_read_only = off
#session_replication_role = 'origin'

View File

@ -7,7 +7,7 @@
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.111 2010/01/02 16:58:10 momjian Exp $
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.112 2010/01/26 16:33:40 tgl Exp $
*--------------------------------------------------------------------
*/
#ifndef GUC_H
@ -181,8 +181,6 @@ extern char *HbaFileName;
extern char *IdentFileName;
extern char *external_pid_file;
extern char *default_do_language;
extern char *application_name;
extern int tcp_keepalives_idle;

View File

@ -3984,7 +3984,7 @@ BEGIN
LOOP
RAISE NOTICE '%, %', r.roomno, r.comment;
END LOOP;
END$$ LANGUAGE plpgsql;
END$$;
NOTICE: 001, Entrance
NOTICE: 002, Office
NOTICE: 003, Office
@ -4000,7 +4000,7 @@ DO LANGUAGE plpgsql $$begin return 1; end$$;
ERROR: RETURN cannot have a parameter in function returning void
LINE 1: DO LANGUAGE plpgsql $$begin return 1; end$$;
^
DO LANGUAGE plpgsql $$
DO $$
DECLARE r record;
BEGIN
FOR r IN SELECT rtrim(roomno) AS roomno, foo FROM Room ORDER BY roomno

View File

@ -3164,12 +3164,12 @@ BEGIN
LOOP
RAISE NOTICE '%, %', r.roomno, r.comment;
END LOOP;
END$$ LANGUAGE plpgsql;
END$$;
-- these are to check syntax error reporting
DO LANGUAGE plpgsql $$begin return 1; end$$;
DO LANGUAGE plpgsql $$
DO $$
DECLARE r record;
BEGIN
FOR r IN SELECT rtrim(roomno) AS roomno, foo FROM Room ORDER BY roomno