[Spacewalk-list] Template tables in database

Daryl Rose darylrose at outlook.com
Fri Dec 2 13:50:26 UTC 2016


Thank you Paul.  I appreciate the information.   I'll leave them alone.


Daryl

________________________________
From: spacewalk-list-bounces at redhat.com <spacewalk-list-bounces at redhat.com> on behalf of Paul Robert Marino <prmarino1 at gmail.com>
Sent: Wednesday, November 30, 2016 9:32 PM
To: Daryl Rose
Subject: Re: [Spacewalk-list] Template tables in database

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 https://www.postgresql.org/docs/9.4/static/manage-ag-templatedbs.html
PostgreSQL: Documentation: 9.4: Template Databases<https://www.postgresql.org/docs/9.4/static/manage-ag-templatedbs.html>
www.postgresql.org
21.3. Template Databases. CREATE DATABASE actually works by copying an existing database. By default, it copies the standard system database named template1.


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.

On Wed, Nov 30, 2016 at 7:49 PM, <prmarino1 at gmail.com<mailto:prmarino1 at gmail.com>> wrote:
NO YOU CAN NOT!!!!
Those are part of how PostgerSQL works under the hood whenever a new table is created.
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?.
Do not ever remove those templates!

From: Daryl Rose
Sent: Wednesday, November 30, 2016 12:24
To: spacewalk-list at redhat.com<mailto:spacewalk-list at redhat.com>
Reply To: spacewalk-list at redhat.com<mailto:spacewalk-list at redhat.com>
Subject: [Spacewalk-list] Template tables in database



Hello,


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.


pg_dump: [archiver (db)] connection to database "template1" failed: FATAL:  no pg_hba.conf entry for host "[local]", user "postgres", database "template1", SSL off
pg_dumpall: pg_dump failed on database "template1", exiting


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.


local rhnschema rhnuser md5
host  rhnschema rhnuser 127.0.0.1/8<http://127.0.0.1/8> md5
host  rhnschema rhnuser ::1/128 md5
local rhnschema postgres ident map=usermap
local postgres postgres ident map=usermap


I can add in the two tables, but I would prefer to remove them if they're not needed.


Thank you.


Daryl



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20161202/52317160/attachment.htm>


More information about the Spacewalk-list mailing list