<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Thank you Paul.  I appreciate the information.   I'll leave them alone.  </p>
<p><br>
</p>
<p>Daryl</p>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> spacewalk-list-bounces@redhat.com <spacewalk-list-bounces@redhat.com> on behalf of Paul Robert Marino <prmarino1@gmail.com><br>
<b>Sent:</b> Wednesday, November 30, 2016 9:32 PM<br>
<b>To:</b> Daryl Rose<br>
<b>Subject:</b> Re: [Spacewalk-list] Template tables in database</font>
<div> </div>
</div>
<div>
<div dir="ltr">actually slight fix on a typo in the previous email they are used in the creation of a new database not a table, also if you want to understand why they are there read this short page <a href="https://www.postgresql.org/docs/9.4/static/manage-ag-templatedbs.html" id="LPlnk418428" previewremoved="true">https://www.postgresql.org/docs/9.4/static/manage-ag-templatedbs.html</a>
<div id="LPBorder_GT_14806865717770.3499543791058992" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_14806865717750.9532019465686579" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_14806865717760.3292425644871535" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_14806865717760.41775072373429123"></div>
<div id="LPTitle_14806865717760.5141255780964129" style="top: 0px; color: rgb(0, 120, 215); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_14806865717760.856177480178201" href="https://www.postgresql.org/docs/9.4/static/manage-ag-templatedbs.html" target="_blank" style="text-decoration: none;">PostgreSQL: Documentation: 9.4: Template Databases</a></div>
<div id="LPMetadata_14806865717760.34200477537428475" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
www.postgresql.org</div>
<div id="LPDescription_14806865717770.7699284959063759" style="display: block; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
21.3. Template Databases. CREATE DATABASE actually works by copying an existing database. By default, it copies the standard system database named template1.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<div>incidentally you can use that "create database NAME template DATABASENAME" syntax to duplicate any database in PostgreSQL,, but if you don't specify a template in the create database command the planner adds "TEMPLATE template1" to it without your knowledge.
 If template1 does not exist then the command will fail and depending on the version the database server may crash.</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Nov 30, 2016 at 7:49 PM, <span dir="ltr"><<a href="mailto:prmarino1@gmail.com" target="_blank">prmarino1@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr" lang="zh-CN" style="background-color:rgb(255,255,255); line-height:initial">
<div style="width:100%; font-size:initial; font-family:Calibri,'Slate Pro',sans-serif,sans-serif; color:rgb(31,73,125); text-align:initial; background-color:rgb(255,255,255)">
NO YOU CAN NOT!!!!</div>
<div style="width:100%; font-size:initial; font-family:Calibri,'Slate Pro',sans-serif,sans-serif; color:rgb(31,73,125); text-align:initial; background-color:rgb(255,255,255)">
Those are part of how PostgerSQL works under the hood whenever a new table is created.</div>
<div style="width:100%; font-size:initial; font-family:Calibri,'Slate Pro',sans-serif,sans-serif; color:rgb(31,73,125); text-align:initial; background-color:rgb(255,255,255)">
You may not be aware of it but any time you create a table in PostgreSQL it uses one of those 2 templates to set up a lot of things you need under the hood like the ability for the pgsql user to manage them‎.</div>
<div style="width:100%; font-size:initial; font-family:Calibri,'Slate Pro',sans-serif,sans-serif; color:rgb(31,73,125); text-align:initial; background-color:rgb(255,255,255)">
Do not ever remove those templates!</div>
<div style="width:100%; font-size:initial; font-family:Calibri,'Slate Pro',sans-serif,sans-serif; color:rgb(31,73,125); text-align:initial; background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-size:initial; font-family:Calibri,'Slate Pro',sans-serif,sans-serif; color:rgb(31,73,125); text-align:initial; background-color:rgb(255,255,255)">
</div>
<table width="100%" style="background-color:white; border-spacing:0px">
<tbody>
<tr>
<td colspan="2" style="font-size:initial; text-align:initial; background-color:rgb(255,255,255)">
<div style="border-style:solid none none; border-top-color:rgb(181,196,223); border-top-width:1pt; padding:3pt 0in 0in; font-family:Tahoma,'BB Alpha Sans','Slate Pro'; font-size:10pt">
<div><b>From: </b>Daryl Rose</div>
<div><b>Sent: </b>Wednesday, November 30, 2016 12:24</div>
<div><b>To: </b><a href="mailto:spacewalk-list@redhat.com" target="_blank">spacewalk-list@redhat.com</a></div>
<div><b>Reply To: </b><a href="mailto:spacewalk-list@redhat.com" target="_blank">spacewalk-list@redhat.com</a></div>
<div><b>Subject: </b>[Spacewalk-list] Template tables in database</div>
</div>
</td>
</tr>
</tbody>
</table>
<div>
<div class="h5">
<div style="border-style:solid none none; border-top-color:rgb(186,188,209); border-top-width:1pt; font-size:initial; text-align:initial; background-color:rgb(255,255,255)">
</div>
<br>
<div id="m_-4755456268511863281_originalContent">
<div id="m_-4755456268511863281divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hello,</p>
<p><br>
</p>
<p>During the virtual to physical migration, I discovered that there are two template tables in the postgres database.  Can I remove these, or are they needed for the WUI?  The reason why I ask is because I get errors when backing them up.  </p>
<p><br>
</p>
<p></p>
<div><i><span style="color:rgb(255,0,0)">pg_dump: [archiver (db)] connection to database "template1" failed: FATAL:  no pg_hba.conf entry for host "[local]", user "postgres", database "template1", SSL off</span></i></div>
<div><i><span style="color:rgb(255,0,0)">pg_dumpall: pg_dump failed on database "template1", exiting</span></i></div>
<br>
<p></p>
<p>Review some documentation, I see that I can add an entry to the pg_hba.conf file that would allow them to be backed up.  However, when I look at the pg_hba.conf file, I see that postgres and rhnschema are defined, but the two template tables are not.  </p>
<p><br>
</p>
<p><i></i></p>
<div><i><span style="color:rgb(255,0,0)">local rhnschema rhnuser md5</span></i></div>
<div><i><span style="color:rgb(255,0,0)">host  rhnschema rhnuser <a href="http://127.0.0.1/8" target="_blank">
127.0.0.1/8</a> md5</span></i></div>
<div><i><span style="color:rgb(255,0,0)">host  rhnschema rhnuser ::1/128 md5</span></i></div>
<div><i><span style="color:rgb(255,0,0)">local rhnschema postgres ident map=usermap</span></i></div>
<div><i><span style="color:rgb(255,0,0)">local postgres postgres ident map=usermap</span></i></div>
<i><br>
</i>
<p></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">I can add in the two tables, but I would prefer to remove them if </span><span style="font-family:Calibri,Arial,Helvetica,sans-serif,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">they're</span><span style="font-family:Calibri,Arial,Helvetica,sans-serif,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px"> not
 needed.</span><br>
</p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px"><br>
</span></p>
<p>Thank you.</p>
<p><br>
</p>
<p>Daryl</p>
<p><br>
</p>
</div>
<br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>