diff options
author | Shigeru Hanada | 2011-07-04 00:50:47 +0000 |
---|---|---|
committer | Shigeru Hanada | 2011-07-04 00:50:47 +0000 |
commit | 99c74ddec4ba4dfcdf477c947a16924595e6d977 (patch) | |
tree | bb798e53d24fdc794fb0e625ad456b4f16032f57 | |
parent | c01a5997ba93d319a9aed4f164305efcd9e5d0b6 (diff) | |
parent | 99e47ed0b2d2c559da813e679260e218f2c1d2ee (diff) |
Merge branch 'master' into check_alwayscheck_always
31 files changed, 188 insertions, 97 deletions
diff --git a/contrib/Makefile b/contrib/Makefile index 696776795e..0c238aae16 100644 --- a/contrib/Makefile +++ b/contrib/Makefile @@ -52,18 +52,26 @@ SUBDIRS = \ ifeq ($(with_openssl),yes) SUBDIRS += sslinfo +else +ALWAYS_SUBDIRS += sslinfo endif ifeq ($(with_ossp_uuid),yes) SUBDIRS += uuid-ossp +else +ALWAYS_SUBDIRS += uuid-ossp endif ifeq ($(with_libxml),yes) SUBDIRS += xml2 +else +ALWAYS_SUBDIRS += xml2 endif ifeq ($(with_selinux),yes) SUBDIRS += sepgsql +else +ALWAYS_SUBDIRS += sepgsql endif # Missing: @@ -71,3 +79,4 @@ endif $(recurse) +$(recurse_always) diff --git a/contrib/pg_upgrade/check.c b/contrib/pg_upgrade/check.c index 1ee2acac83..5c5ce72294 100644 --- a/contrib/pg_upgrade/check.c +++ b/contrib/pg_upgrade/check.c @@ -29,6 +29,9 @@ output_check_banner(bool *live_check) if (user_opts.check && is_server_running(old_cluster.pgdata)) { *live_check = true; + if (old_cluster.port == DEF_PGUPORT) + pg_log(PG_FATAL, "When checking a live old server, " + "you must specify the old server's port number.\n"); if (old_cluster.port == new_cluster.port) pg_log(PG_FATAL, "When checking a live server, " "the old and new port numbers must be different.\n"); diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c index 4401a81562..d29aad0e1d 100644 --- a/contrib/pg_upgrade/option.c +++ b/contrib/pg_upgrade/option.c @@ -58,8 +58,8 @@ parseCommandLine(int argc, char *argv[]) os_info.progname = get_progname(argv[0]); /* Process libpq env. variables; load values here for usage() output */ - old_cluster.port = getenv("PGPORT") ? atoi(getenv("PGPORT")) : DEF_PGPORT; - new_cluster.port = getenv("PGPORT") ? atoi(getenv("PGPORT")) : DEF_PGPORT; + old_cluster.port = getenv("PGPORTOLD") ? atoi(getenv("PGPORTOLD")) : DEF_PGUPORT; + new_cluster.port = getenv("PGPORTNEW") ? atoi(getenv("PGPORTNEW")) : DEF_PGUPORT; os_user_effective_id = get_user_info(&os_info.user); /* we override just the database user name; we got the OS id above */ @@ -203,13 +203,13 @@ parseCommandLine(int argc, char *argv[]) } /* Get values from env if not already set */ - check_required_directory(&old_cluster.bindir, "OLDBINDIR", "-b", + check_required_directory(&old_cluster.bindir, "PGBINOLD", "-b", "old cluster binaries reside"); - check_required_directory(&new_cluster.bindir, "NEWBINDIR", "-B", + check_required_directory(&new_cluster.bindir, "PGBINNEW", "-B", "new cluster binaries reside"); - check_required_directory(&old_cluster.pgdata, "OLDDATADIR", "-d", + check_required_directory(&old_cluster.pgdata, "PGDATAOLD", "-d", "old cluster data resides"); - check_required_directory(&new_cluster.pgdata, "NEWDATADIR", "-D", + check_required_directory(&new_cluster.pgdata, "PGDATANEW", "-D", "new cluster data resides"); } @@ -254,17 +254,17 @@ For example:\n\ or\n"), old_cluster.port, new_cluster.port, os_info.user); #ifndef WIN32 printf(_("\ - $ export OLDDATADIR=oldCluster/data\n\ - $ export NEWDATADIR=newCluster/data\n\ - $ export OLDBINDIR=oldCluster/bin\n\ - $ export NEWBINDIR=newCluster/bin\n\ + $ export PGDATAOLD=oldCluster/data\n\ + $ export PGDATANEW=newCluster/data\n\ + $ export PGBINOLD=oldCluster/bin\n\ + $ export PGBINNEW=newCluster/bin\n\ $ pg_upgrade\n")); #else printf(_("\ - C:\\> set OLDDATADIR=oldCluster/data\n\ - C:\\> set NEWDATADIR=newCluster/data\n\ - C:\\> set OLDBINDIR=oldCluster/bin\n\ - C:\\> set NEWBINDIR=newCluster/bin\n\ + C:\\> set PGDATAOLD=oldCluster/data\n\ + C:\\> set PGDATANEW=newCluster/data\n\ + C:\\> set PGBINOLD=oldCluster/bin\n\ + C:\\> set PGBINNEW=newCluster/bin\n\ C:\\> pg_upgrade\n")); #endif printf(_("\nReport bugs to <[email protected]>.\n")); diff --git a/contrib/pg_upgrade/pg_upgrade.h b/contrib/pg_upgrade/pg_upgrade.h index 613ddbd03f..4729ac39d9 100644 --- a/contrib/pg_upgrade/pg_upgrade.h +++ b/contrib/pg_upgrade/pg_upgrade.h @@ -15,6 +15,9 @@ #include "libpq-fe.h" +/* Use port in the private/dynamic port number range */ +#define DEF_PGUPORT 50432 + /* Allocate for null byte */ #define USER_NAME_SIZE 128 diff --git a/doc/src/sgml/pgupgrade.sgml b/doc/src/sgml/pgupgrade.sgml index b24c1e7b98..102ca526bb 100644 --- a/doc/src/sgml/pgupgrade.sgml +++ b/doc/src/sgml/pgupgrade.sgml @@ -60,14 +60,14 @@ <term><option>-b</option> <replaceable>old_bindir</></term> <term><option>--old-bindir=</option><replaceable>old_bindir</></term> <listitem><para>the old cluster executable directory; - environment variable <envar>OLDBINDIR</></para></listitem> + environment variable <envar>PGBINOLD</></para></listitem> </varlistentry> <varlistentry> <term><option>-B</option> <replaceable>new_bindir</></term> <term><option>--new-bindir=</option><replaceable>new_bindir</></term> <listitem><para>the new cluster executable directory; - environment variable <envar>NEWBINDIR</></para></listitem> + environment variable <envar>PGBINNEW</></para></listitem> </varlistentry> <varlistentry> @@ -80,14 +80,14 @@ <term><option>-d</option> <replaceable>old_datadir</></term> <term><option>--old-datadir=</option><replaceable>old_datadir</></term> <listitem><para>the old cluster data directory; environment - variable <envar>OLDDATADIR</></para></listitem> + variable <envar>PGDATAOLD</></para></listitem> </varlistentry> <varlistentry> <term><option>-D</option> <replaceable>new_datadir</></term> <term><option>--new-datadir=</option><replaceable>new_datadir</></term> <listitem><para>the new cluster data directory; environment - variable <envar>NEWDATADIR</></para></listitem> + variable <envar>PGDATANEW</></para></listitem> </varlistentry> <varlistentry> @@ -118,14 +118,14 @@ <term><option>-p</option> <replaceable>old_port_number</></term> <term><option>--old-port=</option><replaceable>old_portnum</></term> <listitem><para>the old cluster port number; environment - variable <envar>PGPORT</></para></listitem> + variable <envar>PGPORTOLD</></para></listitem> </varlistentry> <varlistentry> <term><option>-P</option> <replaceable>new_port_number</></term> <term><option>--new-port=</option><replaceable>new_portnum</></term> <listitem><para>the new cluster port number; environment - variable <envar>PGPORT</></para></listitem> + variable <envar>PGPORTNEW</></para></listitem> </varlistentry> <varlistentry> @@ -256,8 +256,7 @@ gmake prefix=/usr/local/pgsql.new install so you might want to set authentication to <literal>trust</> in <filename>pg_hba.conf</>, or if using <literal>md5</> authentication, use a <filename>~/.pgpass</> file (see <xref linkend="libpq-pgpass">) - to avoid being prompted repeatedly for a password. Also make sure - pg_upgrade is the only program that can connect to the clusters. + to avoid being prompted repeatedly for a password. </para> </step> @@ -305,7 +304,10 @@ NET STOP pgsql-8.3 (<productname>PostgreSQL</> 8.3 and older used a different s requires that the old and new cluster data directories be in the same file system. See <literal>pg_upgrade --help</> for a full list of options. - </para> + </para> + + <para> + </para> <para> For Windows users, you must be logged into an administrative account, and @@ -335,7 +337,9 @@ pg_upgrade.exe </para> <para> - Obviously, no one should be accessing the clusters during the upgrade. + Obviously, no one should be accessing the clusters during the + upgrade. <application>pg_upgrade</> defaults to running servers + on port 50432 to avoid unintended client connections. </para> <para> diff --git a/src/Makefile.global.in b/src/Makefile.global.in index ba0822383f..3bf658d6b0 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -19,6 +19,8 @@ # Meta configuration standard_targets = all install installdirs uninstall distprep clean distclean maintainer-clean coverage check installcheck maintainer-check +# these targets should recurse even into subdirectories not being built: +standard_always_targets = distprep clean distclean maintainer-clean .PHONY: $(standard_targets) install-strip html man installcheck-parallel @@ -603,6 +605,16 @@ endef # $3: target to run in subdir (defaults to current element of $1) recurse = $(foreach target,$(if $1,$1,$(standard_targets)),$(foreach subdir,$(if $2,$2,$(SUBDIRS)),$(eval $(call _create_recursive_target,$(target),$(subdir),$(if $3,$3,$(target)))))) +# If a makefile's list of SUBDIRS varies depending on configuration, then +# any subdirectories excluded from SUBDIRS should instead be added to +# ALWAYS_SUBDIRS, and then it must call recurse_always as well as recurse. +# This ensures that distprep, distclean, etc will apply to all subdirectories. +# In the normal case all arguments will be defaulted. +# $1: targets to make recursive (defaults to standard_always_targets) +# $2: list of subdirs (defaults to ALWAYS_SUBDIRS variable) +# $3: target to run in subdir (defaults to current element of $1) +recurse_always = $(foreach target,$(if $1,$1,$(standard_always_targets)),$(foreach subdir,$(if $2,$2,$(ALWAYS_SUBDIRS)),$(eval $(call _create_recursive_target,$(target),$(subdir),$(if $3,$3,$(target)))))) + ########################################################################## # diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index 41e92992de..ce795a61c5 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -311,19 +311,6 @@ RangeVarGetCreationNamespace(const RangeVar *newRelation) newRelation->relname))); } - if (newRelation->relpersistence == RELPERSISTENCE_TEMP) - { - /* TEMP tables are created in our backend-local temp namespace */ - if (newRelation->schemaname) - ereport(ERROR, - (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("temporary tables cannot specify a schema name"))); - /* Initialize temp namespace if first time through */ - if (!OidIsValid(myTempNamespace)) - InitTempTableNamespace(); - return myTempNamespace; - } - if (newRelation->schemaname) { /* check for pg_temp alias */ @@ -338,6 +325,13 @@ RangeVarGetCreationNamespace(const RangeVar *newRelation) namespaceId = get_namespace_oid(newRelation->schemaname, false); /* we do not check for USAGE rights here! */ } + else if (newRelation->relpersistence == RELPERSISTENCE_TEMP) + { + /* Initialize temp namespace if first time through */ + if (!OidIsValid(myTempNamespace)) + InitTempTableNamespace(); + return myTempNamespace; + } else { /* use the default creation namespace */ @@ -390,6 +384,43 @@ RangeVarGetAndCheckCreationNamespace(const RangeVar *newRelation) } /* + * Adjust the relpersistence for an about-to-be-created relation based on the + * creation namespace, and throw an error for invalid combinations. + */ +void +RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid) +{ + switch (newRelation->relpersistence) + { + case RELPERSISTENCE_TEMP: + if (!isTempOrToastNamespace(nspid)) + { + if (isAnyTempNamespace(nspid)) + ereport(ERROR, + (errcode(ERRCODE_INVALID_TABLE_DEFINITION), + errmsg("cannot create relations in temporary schemas of other sessions"))); + else + ereport(ERROR, + (errcode(ERRCODE_INVALID_TABLE_DEFINITION), + errmsg("cannot create temporary relation in non-temporary schema"))); + } + break; + case RELPERSISTENCE_PERMANENT: + if (isTempOrToastNamespace(nspid)) + newRelation->relpersistence = RELPERSISTENCE_TEMP; + else if (isAnyTempNamespace(nspid)) + ereport(ERROR, + (errcode(ERRCODE_INVALID_TABLE_DEFINITION), + errmsg("cannot create relations in temporary schemas of other sessions"))); + break; + default: + ereport(ERROR, + (errcode(ERRCODE_INVALID_TABLE_DEFINITION), + errmsg("only temporary relations may be created in temporary schemas"))); + } +} + +/* * RelnameGetRelid * Try to resolve an unqualified relation name. * Returns OID if relation found in search path, else InvalidOid. diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index cfc685b949..a3a99d2880 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -432,6 +432,13 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId) errmsg("constraints on foreign tables are not supported"))); /* + * Look up the namespace in which we are supposed to create the relation, + * and check we have permission to create there. + */ + namespaceId = RangeVarGetAndCheckCreationNamespace(stmt->relation); + RangeVarAdjustRelationPersistence(stmt->relation, namespaceId); + + /* * Security check: disallow creating temp tables from security-restricted * code. This is needed because calling code might not expect untrusted * tables to appear in pg_temp at the front of its search path. @@ -443,12 +450,6 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId) errmsg("cannot create temporary table within security-restricted operation"))); /* - * Look up the namespace in which we are supposed to create the relation, - * and check we have permission to create there. - */ - namespaceId = RangeVarGetAndCheckCreationNamespace(stmt->relation); - - /* * Select tablespace to use. If not specified, use default tablespace * (which may in turn default to database's default). */ diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 437d23a810..85a7585c6c 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -1610,6 +1610,7 @@ DefineCompositeType(const RangeVar *typevar, List *coldeflist) * instead of below about a "relation". */ typeNamespace = RangeVarGetCreationNamespace(createStmt->relation); + RangeVarAdjustRelationPersistence(createStmt->relation, typeNamespace); old_type_oid = GetSysCacheOid2(TYPENAMENSP, CStringGetDatum(createStmt->relation->relname), @@ -2046,7 +2047,7 @@ AlterDomainValidateConstraint(List *names, char *constrName) Relation conrel; HeapTuple tup; Form_pg_type typTup; - Form_pg_constraint con; + Form_pg_constraint con = NULL; Form_pg_constraint copy_con; char *conbin; SysScanDesc scan; @@ -2094,13 +2095,10 @@ AlterDomainValidateConstraint(List *names, char *constrName) } if (!found) - { - con = NULL; /* keep compiler quiet */ ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("constraint \"%s\" of domain \"%s\" does not exist", constrName, NameStr(con->conname)))); - } if (con->contype != CONSTRAINT_CHECK) ereport(ERROR, diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c index be681e3fd4..b238199658 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -97,10 +97,10 @@ isViewOnTempTable_walker(Node *node, void *context) *--------------------------------------------------------------------- */ static Oid -DefineVirtualRelation(const RangeVar *relation, List *tlist, bool replace) +DefineVirtualRelation(const RangeVar *relation, List *tlist, bool replace, + Oid namespaceId) { - Oid viewOid, - namespaceId; + Oid viewOid; CreateStmt *createStmt = makeNode(CreateStmt); List *attrList; ListCell *t; @@ -160,7 +160,6 @@ DefineVirtualRelation(const RangeVar *relation, List *tlist, bool replace) /* * Check to see if we want to replace an existing view. */ - namespaceId = RangeVarGetCreationNamespace(relation); viewOid = get_relname_relid(relation->relname, namespaceId); if (OidIsValid(viewOid) && replace) @@ -417,6 +416,7 @@ DefineView(ViewStmt *stmt, const char *queryString) { Query *viewParse; Oid viewOid; + Oid namespaceId; RangeVar *view; /* @@ -480,28 +480,31 @@ DefineView(ViewStmt *stmt, const char *queryString) "names than columns"))); } + /* Unlogged views are not sensible. */ + if (stmt->view->relpersistence == RELPERSISTENCE_UNLOGGED) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("views cannot be unlogged because they do not have storage"))); + /* * If the user didn't explicitly ask for a temporary view, check whether * we need one implicitly. We allow TEMP to be inserted automatically as * long as the CREATE command is consistent with that --- no explicit * schema name. */ - view = stmt->view; + view = copyObject(stmt->view); /* don't corrupt original command */ if (view->relpersistence == RELPERSISTENCE_PERMANENT && isViewOnTempTable(viewParse)) { - view = copyObject(view); /* don't corrupt original command */ view->relpersistence = RELPERSISTENCE_TEMP; ereport(NOTICE, (errmsg("view \"%s\" will be a temporary view", view->relname))); } - /* Unlogged views are not sensible. */ - if (view->relpersistence == RELPERSISTENCE_UNLOGGED) - ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("views cannot be unlogged because they do not have storage"))); + /* Might also need to make it temporary if placed in temp schema. */ + namespaceId = RangeVarGetCreationNamespace(view); + RangeVarAdjustRelationPersistence(view, namespaceId); /* * Create the view relation @@ -510,7 +513,7 @@ DefineView(ViewStmt *stmt, const char *queryString) * aborted. */ viewOid = DefineVirtualRelation(view, viewParse->targetList, - stmt->replace); + stmt->replace, namespaceId); /* * The relation we have just created is not visible to any other commands diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 2f8deb470c..eacd863647 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -2414,6 +2414,13 @@ OpenIntoRel(QueryDesc *queryDesc) errmsg("ON COMMIT can only be used on temporary tables"))); /* + * Find namespace to create in, check its permissions + */ + intoName = into->rel->relname; + namespaceId = RangeVarGetAndCheckCreationNamespace(into->rel); + RangeVarAdjustRelationPersistence(into->rel, namespaceId); + + /* * Security check: disallow creating temp tables from security-restricted * code. This is needed because calling code might not expect untrusted * tables to appear in pg_temp at the front of its search path. @@ -2425,12 +2432,6 @@ OpenIntoRel(QueryDesc *queryDesc) errmsg("cannot create temporary table within security-restricted operation"))); /* - * Find namespace to create in, check its permissions - */ - intoName = into->rel->relname; - namespaceId = RangeVarGetAndCheckCreationNamespace(into->rel); - - /* * Select tablespace to use. If not specified, use default tablespace * (which may in turn default to database's default). */ diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index d40a963b74..1771fee647 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -162,6 +162,7 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString) * possible. */ namespaceid = RangeVarGetAndCheckCreationNamespace(stmt->relation); + RangeVarAdjustRelationPersistence(stmt->relation, namespaceid); /* * If the relation already exists and the user specified "IF NOT EXISTS", @@ -374,7 +375,10 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column) if (cxt->rel) snamespaceid = RelationGetNamespace(cxt->rel); else + { snamespaceid = RangeVarGetCreationNamespace(cxt->relation); + RangeVarAdjustRelationPersistence(cxt->relation, snamespaceid); + } snamespace = get_namespace_name(snamespaceid); sname = ChooseRelationName(cxt->relation->relname, column->colname, diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index 4d07bdd24b..12dbff4c9a 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -1537,17 +1537,9 @@ pg_stat_reset(PG_FUNCTION_ARGS) Datum pg_stat_reset_shared(PG_FUNCTION_ARGS) { - if (PG_ARGISNULL(0)) - /* - * Same error message as in pgstat_reset_shared_counters(), - * to keep translations the same. - */ - ereport(ERROR, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("unrecognized reset target: \"%s\"", "null"), - errhint("Target must be \"bgwriter\"."))); - - pgstat_reset_shared_counters(text_to_cstring(PG_GETARG_TEXT_PP(0))); + char *target = text_to_cstring(PG_GETARG_TEXT_PP(0)); + + pgstat_reset_shared_counters(target); PG_RETURN_VOID(); } diff --git a/src/bin/Makefile b/src/bin/Makefile index 3809412a2d..c333a489f1 100644 --- a/src/bin/Makefile +++ b/src/bin/Makefile @@ -15,8 +15,12 @@ include $(top_builddir)/src/Makefile.global SUBDIRS = initdb pg_ctl pg_dump \ psql scripts pg_config pg_controldata pg_resetxlog pg_basebackup + ifeq ($(PORTNAME), win32) -SUBDIRS+=pgevent +SUBDIRS += pgevent +else +ALWAYS_SUBDIRS += pgevent endif $(recurse) +$(recurse_always) diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index d826b5d31c..34e30aa1d4 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201106211 +#define CATALOG_VERSION_NO 201107031 #endif diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h index 53600969ad..7e1e194794 100644 --- a/src/include/catalog/namespace.h +++ b/src/include/catalog/namespace.h @@ -50,6 +50,7 @@ typedef struct OverrideSearchPath extern Oid RangeVarGetRelid(const RangeVar *relation, bool failOK); extern Oid RangeVarGetCreationNamespace(const RangeVar *newRelation); extern Oid RangeVarGetAndCheckCreationNamespace(const RangeVar *newRelation); +extern void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid); extern Oid RelnameGetRelid(const char *relname); extern bool RelationIsVisible(Oid relid); diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 6980d3e531..16dc70f6fa 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -2663,7 +2663,7 @@ DATA(insert OID = 2230 ( pg_stat_clear_snapshot PGNSP PGUID 12 1 0 0 0 f f f f DESCR("statistics: discard current transaction's statistics snapshot"); DATA(insert OID = 2274 ( pg_stat_reset PGNSP PGUID 12 1 0 0 0 f f f f f v 0 0 2278 "" _null_ _null_ _null_ _null_ pg_stat_reset _null_ _null_ _null_ )); DESCR("statistics: reset collected statistics for current database"); -DATA(insert OID = 3775 ( pg_stat_reset_shared PGNSP PGUID 12 1 0 0 0 f f f f f v 1 0 2278 "25" _null_ _null_ _null_ _null_ pg_stat_reset_shared _null_ _null_ _null_ )); +DATA(insert OID = 3775 ( pg_stat_reset_shared PGNSP PGUID 12 1 0 0 0 f f f t f v 1 0 2278 "25" _null_ _null_ _null_ _null_ pg_stat_reset_shared _null_ _null_ _null_ )); DESCR("statistics: reset collected statistics shared across the cluster"); DATA(insert OID = 3776 ( pg_stat_reset_single_table_counters PGNSP PGUID 12 1 0 0 0 f f f f f v 1 0 2278 "26" _null_ _null_ _null_ _null_ pg_stat_reset_single_table_counters _null_ _null_ _null_ )); DESCR("statistics: reset collected statistics for a single table or index in the current database"); diff --git a/src/pl/Makefile b/src/pl/Makefile index ef630fe8d2..c4a0d1cd07 100644 --- a/src/pl/Makefile +++ b/src/pl/Makefile @@ -16,14 +16,21 @@ SUBDIRS = plpgsql ifeq ($(with_perl), yes) SUBDIRS += plperl +else +ALWAYS_SUBDIRS += plperl endif ifeq ($(with_python), yes) SUBDIRS += plpython +else +ALWAYS_SUBDIRS += plpython endif ifeq ($(with_tcl), yes) SUBDIRS += tcl +else +ALWAYS_SUBDIRS += tcl endif $(recurse) +$(recurse_always) diff --git a/src/pl/plperl/plperl--1.0.sql b/src/pl/plperl/plperl--1.0.sql index befd882745..801900f023 100644 --- a/src/pl/plperl/plperl--1.0.sql +++ b/src/pl/plperl/plperl--1.0.sql @@ -7,3 +7,5 @@ */ CREATE PROCEDURAL LANGUAGE plperl; + +COMMENT ON PROCEDURAL LANGUAGE plperl IS 'PL/Perl procedural language'; diff --git a/src/pl/plperl/plperlu--1.0.sql b/src/pl/plperl/plperlu--1.0.sql index 025f7957c4..d1d213dd5f 100644 --- a/src/pl/plperl/plperlu--1.0.sql +++ b/src/pl/plperl/plperlu--1.0.sql @@ -7,3 +7,5 @@ */ CREATE PROCEDURAL LANGUAGE plperlu; + +COMMENT ON PROCEDURAL LANGUAGE plperlu IS 'PL/PerlU untrusted procedural language'; diff --git a/src/pl/plpgsql/src/plpgsql--1.0.sql b/src/pl/plpgsql/src/plpgsql--1.0.sql index 514562d70f..5eeea56824 100644 --- a/src/pl/plpgsql/src/plpgsql--1.0.sql +++ b/src/pl/plpgsql/src/plpgsql--1.0.sql @@ -7,3 +7,5 @@ */ CREATE PROCEDURAL LANGUAGE plpgsql; + +COMMENT ON PROCEDURAL LANGUAGE plpgsql IS 'PL/pgSQL procedural language'; diff --git a/src/pl/plpython/Makefile b/src/pl/plpython/Makefile index 2c0575501a..56e06d74f1 100644 --- a/src/pl/plpython/Makefile +++ b/src/pl/plpython/Makefile @@ -95,16 +95,8 @@ PSQLDIR = $(bindir) include $(top_srcdir)/src/Makefile.shlib -# Force this dependency to be known even without dependency info built: -plpython.o: spiexceptions.h - -spiexceptions.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-spiexceptions.pl - $(PERL) $(srcdir)/generate-spiexceptions.pl $< > $@ - all: all-lib -distprep: spiexceptions.h - install: all install-lib install-data @@ -151,13 +143,13 @@ installcheck: submake prep3 $(pg_regress_installcheck) --inputdir=./python3 --outputdir=./python3 $(REGRESS_OPTS) $(REGRESS) clean: clean3 -else +else # not Python 3 check: submake $(pg_regress_check) $(REGRESS_OPTS) $(REGRESS) installcheck: submake $(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS) -endif +endif # not Python 3 .PHONY: submake submake: @@ -170,9 +162,6 @@ ifeq ($(PORTNAME), win32) rm -f python${pytverstr}.def endif -maintainer-clean: distclean - rm -f spiexceptions.h - else # can't build all: @@ -183,3 +172,16 @@ all: echo "" endif # can't build + +# distprep and maintainer-clean rules should be run even if we can't build. + +# Force this dependency to be known even without dependency info built: +plpython.o: spiexceptions.h + +spiexceptions.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-spiexceptions.pl + $(PERL) $(srcdir)/generate-spiexceptions.pl $< > $@ + +distprep: spiexceptions.h + +maintainer-clean: distclean + rm -f spiexceptions.h diff --git a/src/pl/plpython/plpython2u--1.0.sql b/src/pl/plpython/plpython2u--1.0.sql index 0e47876502..e3a12b952e 100644 --- a/src/pl/plpython/plpython2u--1.0.sql +++ b/src/pl/plpython/plpython2u--1.0.sql @@ -7,3 +7,5 @@ */ CREATE PROCEDURAL LANGUAGE plpython2u; + +COMMENT ON PROCEDURAL LANGUAGE plpython2u IS 'PL/Python2U untrusted procedural language'; diff --git a/src/pl/plpython/plpython3u--1.0.sql b/src/pl/plpython/plpython3u--1.0.sql index d5c6e5ab96..cd1fb636a0 100644 --- a/src/pl/plpython/plpython3u--1.0.sql +++ b/src/pl/plpython/plpython3u--1.0.sql @@ -7,3 +7,5 @@ */ CREATE PROCEDURAL LANGUAGE plpython3u; + +COMMENT ON PROCEDURAL LANGUAGE plpython3u IS 'PL/Python3U untrusted procedural language'; diff --git a/src/pl/plpython/plpythonu--1.0.sql b/src/pl/plpython/plpythonu--1.0.sql index beb0aa1645..61d3d554c9 100644 --- a/src/pl/plpython/plpythonu--1.0.sql +++ b/src/pl/plpython/plpythonu--1.0.sql @@ -7,3 +7,5 @@ */ CREATE PROCEDURAL LANGUAGE plpythonu; + +COMMENT ON PROCEDURAL LANGUAGE plpythonu IS 'PL/PythonU untrusted procedural language'; diff --git a/src/pl/tcl/pltcl--1.0.sql b/src/pl/tcl/pltcl--1.0.sql index 897e1a1fe9..ecb264c818 100644 --- a/src/pl/tcl/pltcl--1.0.sql +++ b/src/pl/tcl/pltcl--1.0.sql @@ -7,3 +7,5 @@ */ CREATE PROCEDURAL LANGUAGE pltcl; + +COMMENT ON PROCEDURAL LANGUAGE pltcl IS 'PL/Tcl procedural language'; diff --git a/src/pl/tcl/pltclu--1.0.sql b/src/pl/tcl/pltclu--1.0.sql index e53bb04e6d..72dcef11e5 100644 --- a/src/pl/tcl/pltclu--1.0.sql +++ b/src/pl/tcl/pltclu--1.0.sql @@ -7,3 +7,5 @@ */ CREATE PROCEDURAL LANGUAGE pltclu; + +COMMENT ON PROCEDURAL LANGUAGE pltclu IS 'PL/TclU untrusted procedural language'; diff --git a/src/test/regress/expected/create_view.out b/src/test/regress/expected/create_view.out index f2c06854d0..f9490a3a55 100644 --- a/src/test/regress/expected/create_view.out +++ b/src/test/regress/expected/create_view.out @@ -81,11 +81,11 @@ CREATE VIEW temp_view_test.v2 AS SELECT * FROM base_table; -- should fail CREATE VIEW temp_view_test.v3_temp AS SELECT * FROM temp_table; NOTICE: view "v3_temp" will be a temporary view -ERROR: temporary tables cannot specify a schema name +ERROR: cannot create temporary relation in non-temporary schema -- should fail CREATE SCHEMA test_schema CREATE TEMP VIEW testview AS SELECT 1; -ERROR: temporary tables cannot specify a schema name +ERROR: cannot create temporary relation in non-temporary schema -- joins: if any of the join relations are temporary, the view -- should also be temporary -- should be non-temp diff --git a/src/tools/msvc/install.bat b/src/tools/msvc/install.bat index 8c5fb1dccb..1d2ab9c9b0 100644 --- a/src/tools/msvc/install.bat +++ b/src/tools/msvc/install.bat @@ -15,7 +15,7 @@ exit /b 1 SETLOCAL IF NOT EXIST buildenv.pl goto nobuildenv -perl -e "require 'buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat +perl -e "require 'buildenv.pl'; while(($k,$v) = each %%ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat CALL bldenv.bat del bldenv.bat :nobuildenv diff --git a/src/tools/msvc/pgbison.bat b/src/tools/msvc/pgbison.bat index e67b8fcf19..c5d355e5ab 100755 --- a/src/tools/msvc/pgbison.bat +++ b/src/tools/msvc/pgbison.bat @@ -2,7 +2,7 @@ REM src/tools/msvc/pgbison.bat IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv -perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat +perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %%ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat CALL bldenv.bat del bldenv.bat :nobuildenv diff --git a/src/tools/msvc/pgflex.bat b/src/tools/msvc/pgflex.bat index 75f4eb9dfe..e26724cc5f 100755 --- a/src/tools/msvc/pgflex.bat +++ b/src/tools/msvc/pgflex.bat @@ -5,7 +5,7 @@ REM silence flex bleatings about file path style SET CYGWIN=nodosfilewarning IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv -perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat +perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %%ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat CALL bldenv.bat del bldenv.bat :nobuildenv |