Skip to content
Snippets Groups Projects
Commit dad08994 authored by Tom Lane's avatar Tom Lane
Browse files

In initdb's post-bootstrap phase, drop temp tables explicitly.

Although these temp tables will get removed from template1 at the end of
the standalone-backend run, that's too late to keep them from getting
copied into the template0 and postgres databases, now that we use only a
single backend run for the whole sequence.  While no real harm is done
by the extra copies (since they'd be deleted on first use of the temp
schema), it's still unsightly, and it would mean some wasted cycles for
every database creation for the life of the installation.

Oversight in commit c4a8812c.  Noticed by Amit Langote.
parent 4bf87169
No related branches found
No related tags found
No related merge requests found
...@@ -1781,6 +1781,13 @@ setup_description(FILE *cmdfd) ...@@ -1781,6 +1781,13 @@ setup_description(FILE *cmdfd)
" WHERE opdesc NOT LIKE 'deprecated%' AND " " WHERE opdesc NOT LIKE 'deprecated%' AND "
" NOT EXISTS (SELECT 1 FROM pg_description " " NOT EXISTS (SELECT 1 FROM pg_description "
" WHERE objoid = p_oid AND classoid = 'pg_proc'::regclass);\n\n"); " WHERE objoid = p_oid AND classoid = 'pg_proc'::regclass);\n\n");
/*
* Even though the tables are temp, drop them explicitly so they don't get
* copied into template0/postgres databases.
*/
PG_CMD_PUTS("DROP TABLE tmp_pg_description;\n\n");
PG_CMD_PUTS("DROP TABLE tmp_pg_shdescription;\n\n");
} }
#ifdef HAVE_LOCALE_T #ifdef HAVE_LOCALE_T
...@@ -1941,6 +1948,12 @@ setup_collation(FILE *cmdfd) ...@@ -1941,6 +1948,12 @@ setup_collation(FILE *cmdfd)
" WHERE NOT EXISTS (SELECT 1 FROM pg_collation WHERE collname = tmp_pg_collation.collname)" " WHERE NOT EXISTS (SELECT 1 FROM pg_collation WHERE collname = tmp_pg_collation.collname)"
" ORDER BY collname, encoding, (collname = locale) DESC, locale;\n\n"); " ORDER BY collname, encoding, (collname = locale) DESC, locale;\n\n");
/*
* Even though the table is temp, drop it explicitly so it doesn't get
* copied into template0/postgres databases.
*/
PG_CMD_PUTS("DROP TABLE tmp_pg_collation;\n\n");
pclose(locale_a_handle); pclose(locale_a_handle);
if (count == 0 && !debug) if (count == 0 && !debug)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment