From: Tom Lane Date: Tue, 26 Jan 2010 16:33:40 +0000 (+0000) Subject: Remove the default_do_language parameter, instead making DO use a hardwired X-Git-Tag: REL9_0_ALPHA4~176 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d879697cd291a31c635edf17c4b8c170ac40ffc1;p=postgresql 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. --- diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 4a68199195..71097ee21c 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1,4 +1,4 @@ - + Server Configuration @@ -4132,21 +4132,6 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; - - default_do_language (string) - - default_do_language configuration parameter - - - - This parameter specifies the language to use when the - LANGUAGE option is omitted in a - statement. - The default is plpgsql. - - - - transaction isolation level diff --git a/doc/src/sgml/ref/do.sgml b/doc/src/sgml/ref/do.sgml index 0a85144726..a85d598c6a 100644 --- a/doc/src/sgml/ref/do.sgml +++ b/doc/src/sgml/ref/do.sgml @@ -1,5 +1,5 @@ @@ -69,8 +69,7 @@ DO code [ LANGUAGE The name of the procedural language the code is written in. - If omitted, the default is determined by the runtime parameter - . + If omitted, the default is plpgsql. @@ -83,6 +82,7 @@ DO code [ LANGUAGE The procedural language to be used must already have been installed into the current database by means of CREATE LANGUAGE. + plpgsql is installed by default, but other languages are not. @@ -108,8 +108,6 @@ BEGIN END LOOP; END$$; - This example assumes that default_do_language has its - default value, namely plpgsql. diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index 724b756551..5c8e13bc9a 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -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); diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index ab1b84ba60..00ea55d597 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut . * * 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."), diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 2b4e761096..95cab4d64f 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -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' diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index caf6fe10c3..40bbe98918 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -7,7 +7,7 @@ * Copyright (c) 2000-2010, PostgreSQL Global Development Group * Written by Peter Eisentraut . * - * $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; diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out index c2bf41d6fc..619939ffa3 100644 --- a/src/test/regress/expected/plpgsql.out +++ b/src/test/regress/expected/plpgsql.out @@ -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 diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql index 3613194fd9..e181b10898 100644 --- a/src/test/regress/sql/plpgsql.sql +++ b/src/test/regress/sql/plpgsql.sql @@ -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